cmdline args to a piped python prog

Piet van Oostrum piet at
Wed Mar 10 11:48:57 CET 2004

>>>>> "leo" <halloleo at> (L) wrote:

L> hi there
L> a python file can evaluate cmdline arguments like

L> python arg1 arg2 arg3...

L> when i feed python with my program via terminal input like

L> cat | python

L> how can i then specifiy the cmdline arguments arg1 arg2 arg3...?

You could say cat | python - arg1 arg2 arg3
Then sys.argv[1:] contains the arguments.

By the way cat | python * is equivalent to python * <
No need for cat.
Piet van Oostrum <piet at>
Private email: P.van.Oostrum at

More information about the Python-list mailing list