[Tutor] newbie question

Alan Gauld alan.gauld at btinternet.com
Mon Jun 18 01:06:38 CEST 2007


"bellzii" <bellzii at yahoo.com> wrote
> hey everyone , can any1 tell me what does the module optparse do ?


It parses options.
That is it takes a command string and works out what
the various bits mean, in particular the command line
options or "switches".

For example you can call python like this:

$ python -i foo.py

And the -i is an option that tells python not to exity the 
intrerpreter
after running foo.py.

optparse can be usd to validate and select options in your programs.

The documentation includes background info and an extensive
tutorial (this must be one of the best documented modules in
the library) , did you read through it before posting? If so what
did you not understand?

HTH,

Alan G. 




More information about the Tutor mailing list