Computer Science
To read the remaining lines of the file from a file object fobj, we use:
- fobj.read(2)
- fobj.read()
- fobj readline()
- fobj.readlines()
Python Data Handling
2 Likes
Answer
fobj.readlines()
Reason — The syntax to read all lines in a file is <filehandle>.readlines()
. Hence according to this syntax fobj.readlines() is correct format.
Answered By
1 Like
Related Questions
What will be the output of the following snippet?
f = None for i in range(5): with open("data.txt", "w") as f: if i > 2: break print(f.closed)
- True
- False
- None
- Error
To read the next line of the file from a file object fobj, we use:
- fobj.read(2)
- fobj.read()
- fobj.readline()
- fobj.readlines()
The readlines() method returns:
- String
- A list of integers
- A list of single characters
- A list of strings
Which module is required to use the built-in function dump()?
- math
- flush
- pickle
- unpickle