Mercurial > hg > lib > markup
view python/sumUC.py @ 10:73bb35b96624
show good hit output
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Thu, 27 May 2021 06:09:01 -0400 |
parents | 870e13483642 |
children |
line wrap: on
line source
#!/usr/bin/python import sys ss={} n=0 for l in sys.stdin: (count,key)=l.strip().split() ss[key]=ss.get(key,0)+int(count) n+=1 tt=0 for (key,total) in ss.items(): tt+=total print "%s\t%s"%(key,total) print >>sys.stderr,"%s vs. %s"%(n,tt)