Python script to replace characters in string efficiently, based on a specified list of coordinates