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

Skip Montanaro skip at pobox.com
Tue Nov 16 16:58:26 CET 2004


    les> python -c "from sys import stdin; for x in stdin: print x"

    les> gives a syntax error.

    les> Anyone one know how to do this?

How about:

    % python -c 'from sys import stdin
    > for x in stdin:
    >   print x
    > '
    hi there
    bye
    hi there

    bye

Skip



More information about the Python-list mailing list