Single Choice Not Set

QTo read two bytes from a file object infile, we use ____________

ID: #3655 Python File Handling 282 views
Question Info
#3655Q ID
Not SetDifficulty
Python File HandlingTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A infile.read(2)
  • B infile.read()
  • C infile.readline()
  • D infile.readlines()
Correct Answer

Explanation

read () function reads at most n bytes and returns the read bytes as string.
Syntax .read [[n]] read ( [n] )
to read two character, so n = 2 and file name infile
infile.read (2)

Share This Question

Challenge a friend or share with your study group.