--- a/nixspamsum Mon Jun 08 16:10:07 2009 +0000
+++ b/nixspamsum Mon Jun 08 20:33:58 2009 +0000
@@ -93,14 +93,18 @@
clen = len(str(max(domains.values())))
total = sum(domains.values())
if percent:
- format = '%%%ds %%%dd %%5.2f %%%%\n' % (dlen, clen)
+ format = ' %%%ds %%%dd %%6.2f %%%%\n' % (-dlen, clen)
for d, c in doms:
dfrac = 100./total*c
output.write(format % (d, c, dfrac))
+ output.write('%s\n' % ((clen+dlen+14)*'-'))
+ output.write(format % ('total', total, 100))
else:
- format = '%%%ds %%%dd\n' % (dlen, clen)
+ format = ' %%%ds %%%dd\n' % (-dlen, clen)
for d in doms:
output.write(format % d)
+ output.write('%s\n' % ((clen+dlen+4)*'-'))
+ output.write(format % ('total', total))
def showResult(nixspamsum, options):
from cStringIO import StringIO