Vidyalelo
Python · Q54

Files Handling in Python

Programming · Python · question 54

Q54

What is the output of the following code:with open('data.txt', 'r') as file: lines = file.readlines()print(len(lines))

A.
The number of lines in data.txt
B.
An error will occur
Answer
C.
The content of data.txt
D.
The file object file

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board