Which of the following methods returns a list of strings, where each string…
2026
Which of the following methods returns a list of strings, where each string represents a single line from the text file?
- A.
read()
- B.
readline()
- C.
readlines()
- D.
list_read()
Attempted by 152 students.
Show answer & explanation
Correct answer: C
The readlines() method reads all lines from the file object and returns them as a list of strings. Each string in the list represents one line from the file, including the newline character. Other methods like read() return a single string for the entire content, while readline() returns only one line.