getopt: Make argument mandatory

Kent Johnson kent3737 at yahoo.com
Thu Dec 16 15:18:08 EST 2004


Frans Englich wrote:
> On Wednesday 15 December 2004 14:07, Diez B. Roggisch wrote:
> 
>>>In my use of getopt.getopt, I would like to make a certain parameter
>>>mandatory. I know how to specify such that a parameter must have a value
>>>if it's specified, but I also want to make the parameter itself
>>>mandatory(combined with a mandatory value, the result is that the user
>>>must specify a value).
>>
>>Use optparse - in the examples section you'll find what you need.
> 
> 
> I'm slow here, do you mean in of the callback examples in 6.21.4?
> 
> http://docs.python.org/lib/module-optparse.html

No, try here - this section seems to have been deleted from the Python 2.4 docs!
http://www.python.org/doc/2.3.4/lib/optparse-extending-examples.html

Kent



More information about the Python-list mailing list