string.replace()

string.replace(str, old, new[, maxreplace]) → string[source]

Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, only the first maxreplace occurrences are replaced.