[Tutor] Read arguments from command line
joel.goldstick at gmail.com
Mon Mar 28 19:51:34 CEST 2011
On Mon, Mar 28, 2011 at 1:24 PM, Susana Iraiis Delgado Rodriguez <
susana.delgado_s at utzmg.edu.mx> wrote:
> Hello everyone!
> I want to run a python script which reads arguments from command line. I
> searched in web and the module sys.argv came up. But I don't understand how
> it works. I need to know how to pass arguments from command line and make
> the python script works from MS-DOS instead of run my program from the
> python console.
> Is there any documentation?
if you have the following command:
python myprogram.py first second third
sys.argv will be "myprogram.py"
sys.argv will be "first"
sys.argv will be "second"
and so forth
If you need more complicated command line parsing you should look into
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor