str.replace(oldStr,newStr)  用新字符串替换旧字符串

例子:

str = "我要睡觉"

oldStr = "睡觉"
newStr = "吃饭"
str.replace(oldStr,newStr)  # 我要吃饭