I valori per il secondo parametro di seek
sono 0, 1, o 2:
0 - offset is relative to start of file
1 - offset is relative to current position
2 - offset is relative to end of file
Ricordati che puoi controllare le help -
>>> help(file.seek)
Help on method_descriptor:
seek(...)
seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, positive or negative), and 2 (move
relative to end of file, usually negative, although many platforms allow
seeking beyond the end of a file). If the file is opened in text mode,
only offsets returned by tell() are legal. Use of other offsets causes
undefined behavior.
Note that not all file objects are seekable.
fonte
2016-09-28 20:31:59
Un suggerimento: assicurarsi di aprire il file per l'accesso binario, ad esempio: 'open (filename, 'rb')'. – cdarke