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

Skip Montanaro skip at pobox.com
Tue Nov 16 10:58:26 EST 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