In Python, strings are immutable.
What is the standard idiom to walk through a string character-by-character and modify it?
The only methods I can think of a
>>> mystring = "Th1s 1s my str1ng" >>> mystring.replace("1", "i") 'This is my string'
If you want to store this new string you'll have to mystring = mystring.replace("1", "i"). This is because in Python strings are immutable.
mystring = mystring.replace("1", "i")