部分文字列を置換した新しい文字列を返します。
構文
str.replace(old, new, count?)使用例
下記の値を入力するとサンプルに即時反映されます。
print→Hello→Python→World→text = "Hello World World"
print(text.replace("World", "Python"))
# Hello Python Python
# 최대 1번만 치환
print(text.replace("World", "Python", 1))
# Hello Python World