📜  替换python代码示例中的子字符串

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

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

s = 'one two one two one'
print(s.replace(' ', ''))
# Output -
# onetwoonetwoone