def rreplace(s, old, new, occurrence):
    li = s.rsplit(old, occurrence)
return new.join(li)
s
rreplace(s, '2', ' ', 2)
rreplace(s, '2', ' ', 3)
rreplace(s, '2', ' ', 4)
rreplace(s, '2', ' ', 0)
rreplace - How to replace the last occurence of an expression in a string?