Skip to content

Instantly share code, notes, and snippets.

@joshz
Created July 17, 2011 13:32
Show Gist options
  • Save joshz/1087592 to your computer and use it in GitHub Desktop.
Save joshz/1087592 to your computer and use it in GitHub Desktop.
from collections import Counter
cnt = Counter("abracadabra")
print cnt
s = 'abracadabra'
d={}
for c in s:
d[c] = d.get(c, 0)+1
print d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment