I want to replace the n\'th occurrence of a substring in a string.
There\'s got to be something equivalent to what I WANT to do which is
mystring.repl
Elegant and short:
def replace_ocurrance(string,from,to,num) strange_char = “$&$@$$&” return string.replace(from,strange_char,num).replace(strange_char, from,num-1).replace(to, strange_char,1)