stdin -> stdout
limodou
limodou at gmail.com
Fri Aug 19 11:36:17 EDT 2005
2005/8/19, max(01)* <max2 at fisso.casa>:
> 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()
--
I like python!
My Donews Blog: http://www.donews.net/limodou
More information about the Python-list
mailing list