stdin -> stdout

Steven Bethard steven.bethard at
Fri Aug 19 17:57:50 CEST 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, ''):

Note that this uses the second form of iter(), which calls its first 
argument repeatedly until it returns the sentinel value (its second 


More information about the Python-list mailing list