Skip to content

Instantly share code, notes, and snippets.

@neilkod
Created July 30, 2010 22:10
Show Gist options
  • Save neilkod/501403 to your computer and use it in GitHub Desktop.
Save neilkod/501403 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
from collections import defaultdict
cnts = defaultdict(int)
for line in sys.stdin:
line = line.strip()
k,v = line.split('\t')
(item1,item2)=k.split(',')
cnts[(int(item1),int(item2))] += 1
for key,val in cnts.items():
print '%s\t%s' % (key,val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment