How to use string.replace() in python 3.x
replace()
is a method of <class 'str'>
in python3:
>>> 'hello, world'.replace(',', ':')
'hello: world'
As in 2.x, use str.replace()
.
Example:
>>> 'Hello world'.replace('world', 'Guido')
'Hello Guido'