Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Programming Exercise 5: Write a program to read through the mail box data and when you find line that starts with From, you will

Computer Programming

Exercise 5: Write a program to read through the mail box data and when you

find line that starts with From, you will split the line into words using the split

function. We are interested in who sent the message, which is the second word on

the From line.

From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008

You will parse the From line and print out the second word for each From line,

then you will also count the number of From (not From:) lines and print out a

count at the end.

This is a good sample output with a few lines removed:

python fromcount.py

Enter a file name: mbox-short.txt

stephen.marquard@uct.ac.za

louis@media.berkeley.edu

zqian@umich.edu

[...some output removed...]

ray@media.berkeley.edu

cwen@iupui.edu

cwen@iupui.edu

cwen@iupui.edu

There were 27 lines in the file with From as the first word

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_2

Step: 3

blur-text-image_3

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

When should the last word in a title be capitalized?

Answered: 1 week ago