Skip to content

Instantly share code, notes, and snippets.

@brettfreer
Last active June 12, 2016 09:02
Show Gist options
  • Save brettfreer/531c21c3e528b5a34a85252693a3626d to your computer and use it in GitHub Desktop.
Save brettfreer/531c21c3e528b5a34a85252693a3626d to your computer and use it in GitHub Desktop.
Remove duplicate characters from a string
import itertools
def remove_duplicate(s):
return ''.join(ch for ch, _ in itertools.groupby(s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment