Archived
1
0
Fork 0
This repository has been archived on 2024-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
PY4E/Assignment 9.4/main.py
2021-09-08 10:33:48 -05:00

24 lines
511 B
Python

name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
senders = dict()
for line in handle:
line = line.strip().split()
if len(line) > 0:
if line[0] == "From":
email = line[1]
senders[email] = senders.get(email, 0) + 1
largesender = None
largecount = None
for email,count in senders.items():
if largesender == None or count > largecount:
largesender = email
largecount = count
print(largesender,largecount)