Skip to content

Instantly share code, notes, and snippets.

View KarenTheEarth's full-sized avatar

KarenTheEarth

View GitHub Profile
@KarenTheEarth
KarenTheEarth / py4e_ex_09_04
Created April 6, 2023 23:26 — forked from MichelleDalalJian/py4e_ex_09_04
9.4 Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the sender's mail address to a count of the number of times th…
fname = input("Enter file:")
if len(fname) < 1 : name = "mbox-short.txt"
hand = open(fname)
lst = list()
for line in hand:
if not line.startswith("From:"): continue
line = line.split()
lst.append(line[1])