Function Details: seek

Description


Change the stream position to the given byte offset.


Extended Description


The seek() method changes the current file position. For text files, the offset should be a number returned from tell(), or zero. The whence argument is optional and defaults to 0 (absolute file positioning).


Function Signature



Module: io

Class: TextIOWrapper

Parameters



Parameter List


  • offset: int
  • whence: int

Return


Returns the new absolute position.


Return Type


int

Output

Explanation

This example moves the file pointer 5 bytes from the beginning and then reads the rest of the file.