Displaying a File¶
Ask the user for the name of a file to open. Open that file, and display the entire contents of the file on the screen.
You must do this using a for
loop, iterating through each line of the file.
Name your program display_a_file.py
Open which file: score.txt
Mitchell
32767
Open which file: letter.txt
+---------------------------------------------------------+
| #### |
| #### |
| #### |
| |
| |
| Bill Gates |
| 101 Microsoft Way |
| Redmond, WA 78641 |
| |
+---------------------------------------------------------+
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing