「Python3入門」str.replace(old, new[, max])のサンプル

サンプルコード:
#!/usr/bin/python3

str = “welcome to www.arkgame.com”
print (“old homepage:”, str)
print (“new homepage:”, str.replace(“arkgame.com”, “sample.com”))

str = “this is string example”
print (str.replace(“is”, “was”, 3))

Comments are closed.