Skip to content

Instantly share code, notes, and snippets.

@rahul8590
Created February 27, 2013 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahul8590/5047746 to your computer and use it in GitHub Desktop.
Save rahul8590/5047746 to your computer and use it in GitHub Desktop.
If you want a dictonary consisting of repeating characters only for a given string in python.
# To get a dictionary of repeated characters in a given string
some_dict = {}
for i,c in enumerate("testing"):
some_dict[c] = some_dict.get(c,0) + 1
some_dict = {key: value for key, value in some_dict.items() if value != 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment