python 3中的replace()方法简单地用于:a = "This is the island of istanbul"print (a.replace("is" , "was" , 3))#3 is the maximum replacement that can be done in the string#>>> Thwas was the wasland of istanbul# Last substring 'is' in istanbul is not replaced by was because maximum of 3 has already been reached