Skip to content

Commit 3d84633

Browse files
Add files via upload
1 parent fbb8d4d commit 3d84633

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#program to read through the mbox-short.txt and figure out who has
2+
#sent the greatest number of mail messages.
3+
senders=dict()
4+
#file_name = input("Enter file name:")
5+
file_name="mbox-short.txt"
6+
handle = open(file_name)
7+
for lines in handle:
8+
phrase_list=lines.split()
9+
if 'From' in phrase_list:
10+
key=phrase_list[1]
11+
senders[key]=senders.get(key,0)+1
12+
v_max=0
13+
email_of_max=''
14+
for k,v in senders.items():
15+
#print(k,v)#debug line
16+
if v>=v_max:
17+
v_max=v
18+
email_of_max=k
19+
20+
print(email_of_max,v_max)

0 commit comments

Comments
 (0)