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
Here is an example using translate to switch "-" with "." and uppercase "a"s
>>> from string import maketrans
>>> trans_table = maketrans(".-a","-.A")
>>> "foo-bar.".translate(trans_table)
'foo.bAr-'
This is much more efficient that flipping to byte array and back if you just need to do single char replacements