Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

when using a wireless access point what is infrastructure mode

Answered: 1 week ago