Computer Science
To read the next line of the file from a file object infi, we use
- infi.read(all)
- infi.read()
- infi.readline()
- infi.readlines()
Python File Handling
2 Likes
Answer
infi.readline()
Reason — The syntax to read a line in a file is <filehandle>.readline()
. Hence according to this syntax infi.readline() is correct format.
Answered By
1 Like
Related Questions
Which of the following format of files can be created programmatically through Python to store some data ?
- Data files
- Text files
- Video files
- Binary files
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 remaining lines 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