Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Download input.txt and store it in the same location as the script file. 2 . Write a program that will go through the

1. Download input.txt and store it in the same location as the script file.
2. Write a program that will go through the lines in input.txt:
a. If a line begins with From (use regular expressions to find the lines)
i. Extract the email address, day, date, month, year, and time (please note that there should be a space after the word From to avoid logic errors).
ii. Send the details to a csv file named output.csv with the help of csv methods. This output.csv file should be stored in the same location as the script file.
iii. The contents of your output.csv file should be identical to sample.csv (include the header row).
b. If a line begins with From: (use regular expressions to find the lines)
i. Extract the email address (please note that the colon is part of the word because there are lines that begin with From without a colon at the end).
ii. Keep track of how many times an email is sent from a particular address with the help of a dictionary.
iii. Send your dictionary results to an output file called output.txt. This output.txt file should be stored in the same location as the script file.
iv. The contents of your output.txt file should be identical to sample.txt (include the last row showing total email count).

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: 3

blur-text-image

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

Students also viewed these Databases questions