#!/usr/bin/python
import re
arrays=[]
fr = open('current','r')
dict={}
for line in fr:
p = re.compile(r'.*\s+(\w+@gmail\.com).*')
m = p.match(line)
if m:
s_t = m.group(1)
dict[s_t] = dict.get(s_t, 0) + 1
# arrays.append(s_t)
#arrays.sort()
for keys in dict:
value = dict.get(keys,0)
print keys, value
for i in dict.iteritems():
print i[0],i[1],i
for i in sorted(dict.iteritems(),key=lambda d:d[1],reverse = False):
value = dict.get(i,0)
print i[0],i[1]
阅读(1474) | 评论(0) | 转发(0) |