str.replace(oldStr,newStr) 用新字符串替换旧字符串
例子:
str = "我要睡觉" oldStr = "睡觉" newStr = "吃饭" str.replace(oldStr,newStr) # 我要吃饭
replace替换字符串
原文:https://www.cnblogs.com/luguankun/p/11901975.html