Skip to content

Instantly share code, notes, and snippets.

@joohee
Last active January 5, 2016 04:36
Show Gist options
  • Save joohee/f69502fc376dc0d0b330 to your computer and use it in GitHub Desktop.
Save joohee/f69502fc376dc0d0b330 to your computer and use it in GitHub Desktop.
from collections import Counter
cnt = Counter()
print('start')
with open('input.txt') as f:
for line in f:
splits = line.split(' - ', 1)
if len(splits) > 1:
cnt[splits[1]] += 1
with open('output.txt', 'w') as wf:
for k, v in cnt.most_common():
wf.write( "{} {}\n".format(k,v) )
print('done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment