limodou wrote: > 2005/8/19, max(01)* <[EMAIL PROTECTED]>: > >>hi. >> >>i was wondering, what's the simplest way to echo the standard input to >>the standard output, with no modification. >> >>i came up with: >> >>... >>while True: >> try: >> raw_input() >> except EOFError: >> break >>... >> >>but i guess there must be a simpler way. >> >>using bash i simply do 'cat', *sigh*! >> >>bye >> >>max >> >>ps: in perl you ca do this: >> >>... >>while ($line = <STDIN>) >> { >> print STDOUT ("$line"); >> } >>... > > > Try this. > > import sys > > line = sys.stdin.readline() > while line: > sys.stdout.write(line) > line = sys.stdin.readline() >
Try this: import sys for line in sys.stdin: sys.stdout.write(line) -- http://mail.python.org/mailman/listinfo/python-list