| Store | Cart

cmdline args to a piped python prog

From: Piet van Oostrum <p...@cs.uu.nl>
10 Mar 2004 11:48:57 +0100
>>>>> "leo" <halloleo at noospaam.myrealbox.com> (L) wrote:

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

L> python myprog.py arg1 arg2 arg3...

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

L> cat myprog.py | python

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

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

By the way cat myprog.py | python * is equivalent to python * < myprog.py
No need for cat.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl

Recent Messages in this Thread
leo Mar 10, 2004 06:48 am
Piet van Oostrum Mar 10, 2004 10:48 am
leo Mar 10, 2004 11:19 pm
Messages in this thread