>>> a = 'hello world'
>>> a.replace('hello','ni')
'ni world'
>>> a
'hello world'
>>> a.replace('he','ni')
'nillo world'
>>> a.replace('ac','ni') #ac在字符串中没有,就不会替换
'hello world'
>>> a = 'hello world'
>>> a.replace('hello','ni')
'ni world'
>>> a
'hello world'
>>> a.replace('he','ni')
'nillo world'
>>> a.replace('ac','ni') #ac在字符串中没有,就不会替换
'hello world'