using python with -c (as a inline execution in shell)

les ander les_ander at
Tue Nov 16 16:44:19 CET 2004

in perl one can do all sorts of stuff in a single line form the command shell.
python has the -c option.
it is easy to do stuff like, 
python -c "print 10+20"
etc statements
but suppose I want to read from the stdin (piped) i don't know how to do this since
python -c "from sys import stdin; for x in stdin: print x"

gives a syntax error.

Anyone one know how to do this?
Also, is there is site that talkes about doing this kind of stuff?
the man pages in xterm are pretty sparse and don't say that much

More information about the Python-list mailing list