Archived
1
0
Fork 0
This repository has been archived on 2024-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
PY4E/Assignment 8.5/readme.md
2021-09-08 10:33:48 -05:00

39 lines
1.1 KiB
Markdown

8.5 Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line:
```From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008```
You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who sent the message). Then print out a count at the end.
Hint: make sure not to include the lines that start with 'From:'. Also look at the last line of the sample output to see how to print the count.
Desired Output:
```
stephen.marquard@uct.ac.za
louis@media.berkeley.edu
zqian@umich.edu
rjlowe@iupui.edu
zqian@umich.edu
rjlowe@iupui.edu
cwen@iupui.edu
cwen@iupui.edu
gsilver@umich.edu
gsilver@umich.edu
zqian@umich.edu
gsilver@umich.edu
wagnermr@iupui.edu
zqian@umich.edu
antranig@caret.cam.ac.uk
gopal.ramasammycook@gmail.com
david.horwitz@uct.ac.za
david.horwitz@uct.ac.za
david.horwitz@uct.ac.za
david.horwitz@uct.ac.za
stephen.marquard@uct.ac.za
louis@media.berkeley.edu
louis@media.berkeley.edu
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
```