青岛杀人案,香港自由行报价,李耐阅的qq
直接给出结论:replace方法不会改变原字符串。
temp_str = 'this is a test' print(temp_str.replace('is','is') print(temp_str)
this is a test this is a test
如果是需要对原字符串进行替换,可以这样写,重新赋值
a=a.replace(oldstr,newstr) print(a)
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新手学习Python2和Python3中print不同的用法
Python基于os.environ从windows获取环境变量
网友评论