What is the easiest way in Python to replace a character in a string?
For example:
text = \"abcdefg\";
text[1] = \"Z\";
^
This code is not mine. I couldn't recall the site form where, I took it. Interestingly, you can use this to replace one character or more with one or more charectors. Though this reply is very late, novices like me (anytime) might find it useful.
mytext = 'Hello Zorld'
mytext = mytext.replace('Z', 'W')
print mytext,