ta (was Re: cmdline args to a piped python prog)

leo halloleo at noospaam.myrealbox.com
Wed Mar 10 18:19:24 EST 2004


thanks a lot, piet.

leo

"Piet van Oostrum" <piet at cs.uu.nl> wrote in message
news:wzvfld3rl2.fsf at ordesa.cs.uu.nl...
> >>>>> "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





More information about the Python-list mailing list