Question: I just started learning Python, and have been trying to do some practice problems & examples, but I've been having some difficulty. The following is

I just started learning Python, and have been trying to do some practice problems & examples, but I've been having some difficulty. The following is an example practice problem that I could use some help creating the code for. I'm not sure if I need to pull information from a separate (mbox-short.txt) file that I need to save. Any additional information, such as step-by-step instruction would also be greatly appreciated.

Write a program to read through the mailbox data and when youfind line that starts with From, you will split the line into wordsusing the split function. We are interested in who sent the message which is the second word on the From line. Example: From stephen.marquard@uct.ac.za Sat Jan 5 09:14:162008

The program should have the follow functionalities:

1. Program should prompt the user to enter for a file name (mbox-short.txt)

2. Program also find line that starts with From

3. Program splits the line into words using the split function (For example, From stephen.marquard@uct.ac.za SatJan 5 09:14:16 2008 )

4. Count the number of Froms

5. Program figures out who sent the message, which is email address, and extracts the email address.

6. Print out all email addresses and a count at the end

This is a sample output with a few lines removed: Enter a file name: mbox-short.txtstephen.marquard@uct.ac.zalouis@media.berkeley.eduzqian@umich.edu[...some output removed...] ray@media.berkeley.edu

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!