A few beginning questions

Karl Scalet news at yebu.de
Tue Jul 15 09:32:55 CEST 2003


Thomas Heller schrieb:
> mis6 at pitt.edu (Michele Simionato) writes:
> 
> 
> I have not yet tried optparse. Is it able to parse Windows' style
> command lines (use '/' instead of '-', ignore case of command line
> options, use long options with a single '-' or '/')?

Just tried it, does not handle '/' the same way as '-',
and does not ignore case sensitivity.
Yes, it handles short and long forms. You add options to the
OptionParser and each option can have a short and a long form, i.e:

option_parser.add_option('-v', '--verbose', action='store_true')

After:
(cfg, args_) = parser.parse_args(args)

cfg automatically has verbose as an attribute, nice!

Karl





More information about the Python-list mailing list