Computer Science
To read the remaining lines of the file from a file object infi, we use
- infi.read(all)
- infi.read()
- infi.readline()
- infi.readlines()
Python File Handling
3 Likes
Answer
infi.readlines()
Reason — The syntax to read all lines in a file is <filehandle>.readlines()
. Hence according to this syntax infi.readlines() is correct format.
Answered By
2 Likes
Related Questions
To open a file c:\ss.txt for appending data, we use
- file = open("c:\\ss.txt", "a")
- file = open("c:\\ss.txt", "rw")
- file = open(r"c:\ss.txt", "a")
- file = open(file = "c:\ss.txt", "w")
- file = open(file = "c:\ss.txt", "w")
- file = open("c:\res.txt")
To read the next line of the file from a file object infi, we use
- infi.read(all)
- infi.read()
- infi.readline()
- infi.readlines()
The readlines() method returns
- str
- a list of lines
- a list of single characters
- a list of integers
Which of the following mode will refer to binary data ?
- r
- w
- +
- b