File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -713,6 +713,32 @@ Text I/O
713713 Read until newline or EOF and return a single ``str ``. If the stream is
714714 already at EOF, an empty string is returned.
715715
716+ .. method :: seek(offset, whence=SEEK_SET)
717+
718+ Change the stream position to the given *offset *. Behaviour depends
719+ on the *whence * parameter:
720+
721+ * :data: `SEEK_SET ` or ``0 ``: seek from the start of the stream
722+ (the default); *offset * must either be a number returned by
723+ :meth: `TextIOBase.tell `, or zero. Any other *offset * value
724+ produces undefined behaviour.
725+ * :data: `SEEK_CUR ` or ``1 ``: "seek" to the current position;
726+ *offset * must be zero, which is a no-operation (all other values
727+ are unsupported).
728+ * :data: `SEEK_END ` or ``2 ``: seek to the end of the stream;
729+ *offset * must be zero (all other values are unsupported).
730+
731+ Return the new absolute position as an opaque number.
732+
733+ .. versionadded :: 3.1
734+ The ``SEEK_* `` constants.
735+
736+ .. method :: tell()
737+
738+ Return the current stream position as an opaque number. The number
739+ does not usually represent a number of bytes in the underlying
740+ binary storage.
741+
716742 .. method :: write(s)
717743
718744 Write the string *s * to the stream and return the number of characters
You can’t perform that action at this time.
0 commit comments