Overview:
- The seek() method of TextIOWrapper class from the io module moves the stream pointer to a given position.
Example:
The Python example below stores a position obtained through tell() method and uses it later to move the stream pointer.
|
# Example Python program that moves the # Create a text stream - An io.TextIOWrapper object # Write some text # Store the stream pointer # Write more text # Read from the 2nd line with the position obtained |
Output:
| Stream pointer at position:44 Writing more text...into the stream |