Skip to main contentSkip to solution

_________method reads all the lines and returns the lines along with newline character, as a list of strings.

Solution

✅ Correct Option: 3

The readlines() method reads all the lines of a file and returns them as a list of strings. Each string is one line and keeps its trailing newline character (\n\backslash n).


Option 1: read() returns the whole file content as one single string, not a list.

Option 2: readline() reads only one line at a time, not all lines.

Option 4: read_line() is not a valid Python file method.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question