KnowledgeBoat Logo

Computer Science

Which statement is used to change the file position to an offset value from the start?

  1. fp.seek(offset, 0)
  2. fp.seek(offset, 1)
  3. fp.seek(offset, 2)
  4. None of these

Python Data Handling

2 Likes

Answer

fp.seek(offset, 0)

Reason — The syntax for relative referencing is f.seek(offset, from_what). The statement f.seek(offset, 0) is used to change the file position to an offset value from the start, where 0 sets the reference point at the beginning of the file.

Answered By

1 Like


Related Questions