[python] Replacing instances of a character in a string