How to use string.replace() in python 3.x September 25, 2022 by Tarik As in 2.x, use str.replace(). Example: >>> 'Hello world'.replace('world', 'Guido') 'Hello Guido'