git @ Cat's Eye Technologies Dipple / master python / stream-experiment.py
master

Tree @master (Download .tar.gz)

stream-experiment.py @masterraw · history · blame

#!/usr/bin/env python

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

# a little experiment; try it with redirected input, and without

import sys

print sys.stdin.tell()
line = sys.stdin.readline()
print line
print sys.stdin.tell()
sys.stdin.seek(0, 0)
line = sys.stdin.readline()
print line
print sys.stdin.tell()