Mercurial > hg > cc > azure
view master/bin/finalMerge.py @ 42:1d776e96c16a
works on one file
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Fri, 30 Nov 2018 15:41:02 +0000 |
parents | beae6309d4ec |
children |
line wrap: on
line source
#!/usr/bin/env python3 import sys,re mh={} ms={} mm={} for (i,m) in enumerate(['0','Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec']): mm[m]=i for l in sys.stdin: (h,m,y,c)=l.split() if h=='http': tab=mh else: tab=ms m=mm[m] key='%s\t%s'%(m,y) tab[key]=tab.get(key,0)+int(c) for (l,tab) in zip(['http','https'],[mh,ms]): for (k,v) in tab.items(): print(l,k,v,sep='\t')