📜  在python代码示例中替换多个不同的子字符串

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

代码示例1
s = 'one two three one two three one two'
print(s.replace('one', 'TWO').replace('two', 'ZZZ').replace('three', 'YYY'))

# Output -
# TWO ZZZ YYY TWO ZZZ YYY TWO ZZZ