How to handle two-level option processing with optparse

R. Bernstein rocky at panix.com
Thu Jan 26 10:05:05 CET 2006


Giovanni Bajo suggests:

> If you call OptionParser.disable_interspersed_args() on your parser,
> it will stop parsing at the first positional argument, leaving other
> options unparsed.

Wow - that was a quick answer! Thanks - it works great!

I see how I missed this. Neither disable_.. or enable_.. have document
strings. And neither seem to described in the optparser section (6.21)
of the Python Library (http://docs.python.org/lib/module-optparse.html).

I wonder if something like this might be added to the Python Cookbook.

Thanks again.



More information about the Python-list mailing list