On 2016-12-09, DFS <nos...@dfs.com> wrote:
> import sys as y,nntplib as t,datetime as d
> s='<news server>'
> g=y.argv[1]
> n=t.NNTP(s,119,'<usr>','<pw>')
> r,a,b,e,gn=n.group(g)
> def printStat(st,hd,rg):
>       r,d=n.xhdr(st,'%s-%s'%rg)
>       p=[]
>       for i in range(len(d)):
>               v=d[i][1]
>               if st=='Subject':v=v[4:] if v[:3]=='Re:' else v
>               p.append(v)
>       x=[(i,p.count(i)) for i in set(p)]
>       x.sort(key=lambda s:(-s[1],s[0].lower()))
>       print('Posts  %s %s'%(len(set(p)),hd))
>       for v in x: print(' %s     %s'%(v[1],v[0]))
>       print
> print 'As of '+d.datetime.now().strftime("%I:%M%p %B %d, %Y") + '\n'
> m=(int(e)-int(y.argv[3])+1,int(e))
> printStat("From","Posters",m)
> printStat("Subject","Subjects",m)
> printStat("User-Agent","User-Agents",m)
> n.quit()

Was there ever an "International Obfuscated Python Code Contest"? ;-)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to