Question: PYTHON: Your program will take a file name from user and parse the file. Read and parse the lines that begins with From and pull

PYTHON:

Your program will take a file name from user and parse the file. Read and parse the lines that begins with "From" and pull out the email addresses from the line. Count the number of messages from each person using a dictionary. After all the data has been processed, print the person with the most commits by creating a list of (count, email) tuples from the dictionary. Then sort the list in reverse order and print out top 5 users with email usage. Your output should list each email address and frequency.

If user enters wrong information (wrong name of the file or non-existing file name), your program needs to display message and ask for correct input. Your program should not generate traceback message with any input. Provide comments for all program

Do not read the entire file to process. Use only file handle to process it.

Sample files:

mbox-short.txt

Sample output

======================================================== Enter file name to process:fksaldj;f File fksaldj;f doesn't exist. Please enter correct file name Enter file name to process:mbox-short.txt Here is a list of top 5 email users: ==================================== 10 cwen@iupui.edu 8 zqian@umich.edu 8 david.horwitz@uct.ac.za 6 louis@media.berkeley.edu 6 gsilver@umich.edu ==================================== Do you want to continue? (y/n) n Thank you for playing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!