Skip to content

Instantly share code, notes, and snippets.

@monsterxx03
Created April 21, 2013 11:46
Show Gist options
  • Save monsterxx03/5429336 to your computer and use it in GitHub Desktop.
Save monsterxx03/5429336 to your computer and use it in GitHub Desktop.
Counter
l = ['11', '11', '11', '22', '22', '33']
from collections import Counter
c = Counter(l)
c.most_comon()
>> [('11', 3), ('22', 2), ('33', 1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment