QuestionQ3
VerifiedPython Basics for Data AnalysisYou need to safely read the contents of a file called records.txt and save them in a list. The requirements are:
- The file must be closed automatically after it is read.
- The code should verify that the file exists before opening it.
- Missing-file errors must be handled gracefully.
Which of the following is the most suitable way to do this in Python? Select the best answer.
Community Discussion