Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fname = raw_input("Enter file name: ")
- if len(fname) < 1 : fname = "mbox"
- fh = open(fname)
- dic = dict()
- for line in fh:
- line.rstrip()
- if not line.startswith('From '):
- continue
- else:
- words = line.split()
- time = words[5]
- q = ':'
- t = time.split(q)
- hours = t[:1]
- for cnt in hours:
- dic[cnt] = dic.get(cnt,0) + 1
- lst = list()
- for (k,v) in dic.items():
- lst.append( (k,v) )
- print lst
Advertisement
Add Comment
Please, Sign In to add comment