Question: Write a program, readfile.py which prompts for a filename, opens and reads the file, and prints the contents. Use a try / except to handle
Write a program, readfile.py which prompts for a filename, opens and reads the file, and prints the contents. Use a tryexcept to handle cases where the specified file is not found. Do not use ospath.
If the user enters a filename and the file is not found, your program should prompt the user again for another filename, or the user may enter q to quit.
If the user enters a valid filename, and the file is found and read, your program should quit after printing the contents of the file.
Your program will be tested with names of files that are valid and invalid. Your program will be tested to ensure that entering q does in fact quit.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
