Question: Read a text file from a location. Choose the input file in the same directory as the project source file. The input file contains, several
Read a text file from a location. Choose the input file in the same directory as the project source file.
The input file contains, several information about different persons:
- Name (with Salutation, salutation does not count as part of the name)
-Email address
-Phone number
-Room Number
It is not required to have all information available for every person. For example, one person can not have a phone number or room number.
Your code at first display the following five (5) options:
1. Show all full names
2. Show Email address
3. Show Phone number
4. Show Room number
5. Exit
Based on User input (user enters a number between 1 to 5), you should show all the available information from the text file. Then, you are required to show thetotal countof all the information in each user attempt.
For full names, just show their namewithout salutation(like Dr./ Mr./ Ms.)
You are required to use regular expression to match these criteria. A sample input file is providedhereDownload here.
The code will exit when the user enter option 5.
Step by Step Solution
3.47 Rating (150 Votes )
There are 3 Steps involved in it
python Copy import re def readinputfilefilepath with openfilepath r as file data fileread return dat... View full answer
Get step-by-step solutions from verified subject matter experts
