How to use string.replace() in python 3.x

后端 未结 8 1853
旧巷少年郎
旧巷少年郎 2020-11-22 12:29

The string.replace() is deprecated on python 3.x. What is the new way of doing this?

8条回答
  •  没有蜡笔的小新
    2020-11-22 12:39

    ss = s.replace(s.split()[1], +s.split()[1] + 'gy')
    # should have no plus after the comma --i.e.,
    ss = s.replace(s.split()[1], s.split()[1] + 'gy')
    

提交回复
热议问题