Question: Which of the following Python programs will read data from the text file studentRecords.txt and display the data with no blank lines inserted in the
Which of the following Python programs will read data from the text file "studentRecords.txt" and display the data with no blank lines inserted in the output?
| A. | input_file = open('studentRecords.txt', 'r') for line in input_file: print(line) input_file.close() | |
| B. | input_file = open('studentRecords.txt', 'r') for line in input_file: line = line.strip() print(line) input_file.close() | |
| C. | Both A and B | |
| D. | None of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
