Last active
June 12, 2016 09:02
-
-
Save brettfreer/531c21c3e528b5a34a85252693a3626d to your computer and use it in GitHub Desktop.
Remove duplicate characters from a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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