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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!