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

后端 未结 8 1881
旧巷少年郎
旧巷少年郎 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:37

    Try this:

    mystring = "This Is A String"
    print(mystring.replace("String","Text"))
    

提交回复
热议问题