Right-to-left string replace in Python?

rsplit and join could be used to simulate the effects of an rreplace

>>> 'XXX'.join('mississippi'.rsplit('iss', 1))
'missXXXippi'

Leave a Comment