📜  python代码示例中的最大替换次数

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

代码示例1
s = 'one two one two one'
print(s.replace('one', 'XXX'))
# Output -
# XXX two XXX two XXX

s = 'one two one two one'
print(s.replace('one', 'XXX', 2))
# 2 is the number of count
# Output -
# XXX two XXX two one