Computer Science

To read two characters from a file object fobj, the command should be:

  1. fobj.read(2)
  2. fobj.read()
  3. fobj.readline()
  4. fobj.readlines()

Python Data Handling

3 Likes

Answer

fobj.read(2)

Reason — The command fobj.read(2) is used to read two characters from a file object fobj. The read() method without arguments (fobj.read()) reads the entire content of the file, while fobj.readline() reads a single line, and fobj.readlines() reads all lines and returns them as a list.

Answered By

1 Like


Related Questions