Calculate which day you received how many mails:-
#prompt to input a file
file = raw_input("Enter a file name: ")
try:
#try to open a file
f_obj = open(file, 'r')
#print 'yes'
except:
#if file doesn't open error
print 'can\'t open', file
quit()
#define a dictionry named OUTPUT
output = dict()
#loop through the file for line one at time
for line in f_obj:
line = line.lower()
line = line.rstrip() #remove the white sapce from line's right end
if line.startswith('from '):
#print line
words = line.split()
#print words
key = words[2]
if key in output:
output[key] += 1
else:
output[key] = 1
print output
#prompt to input a file
file = raw_input("Enter a file name: ")
try:
#try to open a file
f_obj = open(file, 'r')
#print 'yes'
except:
#if file doesn't open error
print 'can\'t open', file
quit()
#define a dictionry named OUTPUT
output = dict()
#loop through the file for line one at time
for line in f_obj:
line = line.lower()
line = line.rstrip() #remove the white sapce from line's right end
if line.startswith('from '):
#print line
words = line.split()
#print words
key = words[2]
if key in output:
output[key] += 1
else:
output[key] = 1
print output