Mercurial > hg > lib > markup
view python/sumUC.py @ 13:1cd5c7952aaa default tip
fix failure to read first line of Air/Lava,
keep me from swimming in Lava, again!
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Sun, 30 Jan 2022 14:49:33 -0500 |
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)