Name
seek
Synopsis
f.seek(pos,how=0)Sets f’s current position
to the signed integer byte offset pos from
a reference point. how indicates the
reference point: when how is
0, the reference is the start of the file; when it
is 1, the reference is the current position; and
when it is 2, the reference is the end of the
file. When f is opened in text mode, the
effects of f
.seek may
not be as expected, due to the implied translations between
os.linesep and \n. This
troublesome effect does not occur on Unix platforms, nor when
f is opened in binary mode, nor when
f
.seek is called with a
pos that is the result of a previous call
to f
.tell and
how is 0. When
f is opened in mode 'a'
or 'a+', all data written to
f is appended to the data that is already
in f, regardless of calls to
f
.seek.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access