How can I remove duplicate characters from a string using Python? For example, let\'s say I have a string:
foo = \"SSYYNNOOPPSSIISS\"
How c
How about this:
oldstring = 'SSSYYYNNNOOOOOPPPSSSIIISSS' newstring = oldstring[0] for char in oldstring[1:]: if char != newstring[-1]: newstring += char