Python 3.x で string.replace() を使用する方法 質問する

Python 3.x で string.replace() を使用する方法 質問する

これはstring.replace()Python 3.x では非推奨です。これを行う新しい方法は何ですか?

ベストアンサー1

2.xと同様に、str.replace()

例:

>>> 'Hello world'.replace('world', 'Guido')
'Hello Guido'

おすすめ記事