stdin -> stdout
Steven Bethard
steven.bethard at gmail.com
Fri Aug 19 11:57:50 EDT 2005
max(01)* wrote:
> i was wondering, what's the simplest way to echo the standard input to
> the standard output, with no modification.
import sys
for line in iter(sys.stdin.readline, ''):
sys.stdout.write(line)
Note that this uses the second form of iter(), which calls its first
argument repeatedly until it returns the sentinel value (its second
argument).
STeVe
More information about the Python-list
mailing list