How to use string.replace() in python 3.x

As in 2.x, use str.replace().

Example:

>>> 'Hello world'.replace('world', 'Guido')
'Hello Guido'

Leave a Comment