File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -704,6 +704,32 @@ Text I/O
704704 Read until newline or EOF and return a single ``str ``. If the stream is
705705 already at EOF, an empty string is returned.
706706
707+ .. method :: seek(offset, whence=SEEK_SET)
708+
709+ Change the stream position to the given *offset *. Behaviour depends
710+ on the *whence * parameter:
711+
712+ * :data: `SEEK_SET ` or ``0 ``: seek from the start of the stream
713+ (the default); *offset * must either be a number returned by
714+ :meth: `TextIOBase.tell `, or zero. Any other *offset * value
715+ produces undefined behaviour.
716+ * :data: `SEEK_CUR ` or ``1 ``: "seek" to the current position;
717+ *offset * must be zero, which is a no-operation (all other values
718+ are unsupported).
719+ * :data: `SEEK_END ` or ``2 ``: seek to the end of the stream;
720+ *offset * must be zero (all other values are unsupported).
721+
722+ Return the new absolute position as an opaque number.
723+
724+ .. versionadded :: 3.1
725+ The ``SEEK_* `` constants.
726+
727+ .. method :: tell()
728+
729+ Return the current stream position as an opaque number. The number
730+ does not usually represent a number of bytes in the underlying
731+ binary storage.
732+
707733 .. method :: write(s)
708734
709735 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