📌  相关文章
📜  python 删除字符串中第二次出现的字符 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:12.663000             🧑  作者: Mango

代码示例1
import re 
#Remove the second Hello from example

example = "Hello, world. Hello!" 
print re.sub(r'^((.*?Hello.*?){1})Hello', r'\1Goodbye', str) 
# Prints "Hello, world. Goodbye!"

#To remove any particular occurance adjust the {1} to the desired number