The function string.replace returns a copy of its input argument (a string), with a part of the string replaced with another string:
import string aName="piet" aNewName=string.replace(aName,"iet","eter") print aNewName
When executing the program, it will print
$ python name2.py peter