seek(self,
offset,
whence=os.SEEK_SET)
|
|
Set the file's current position. The whence argument is optional;
legal values are:
- os.SEEK_SET or 0: absolute file positioning (default)
- os.SEEK_CUR or 1: seek relative to the current position
- os.SEEK_END or 2: seek relative to the file's end
There is no return value. Note that if the file is opened for
appending (mode 'a' or 'a+'), any seek() operations will be undone
at the next write. If the file is only opened for writing in append
mode (mode 'a'), this method is essentially a no-op, but it remains
useful for files opened in append mode with reading enabled (mode
'a+'). If the file is opened in text mode (without 'b'), only offsets
returned by tell() are legal. Use of other offsets causes
undefined behavior.
Note that not all file objects are seekable.
- Parameters:
offset (int) - where to seek
whence (int) - see above
|