6.20.3.5 Querying and manipulating your option parser
Sometimes, it's useful to poke around your option parser and see what's
there. OptionParser provides a couple of methods to help you out:
-
Given an option string such as -q or
--verbose, returns true if the OptionParser
has an option with that option string.
-
Returns the Option instance that implements the option
string you supplied, or
None
if no options implement it.
-
If the OptionParser has an option corresponding to
opt_str, that option is removed. If that option provided
any other option strings, all of those option strings become
invalid.
If opt_str does not occur in any option belonging to this
OptionParser, raises ValueError.
Release 2.3.4, documentation updated on May 20, 2004.
See About this document... for information on suggesting changes.