optparse

The optparse module provides high-level support for processing command-line options. It provides similar functionality as the getopt module, but adds a considerable number of new features related to configuration, error handling, and option processing. Use of optparse primarily focuses on the OptionParser class.

OptionParser([**args])

Creates a new command option parser and returns an OptionParser instance. A variety of optional keyword arguments can be supplied to control configuration. These keyword arguments are described in the following list:

Keyword ArgumentDescription
add_help_optionSpecifies whether or not a special help option (--help and -h) is supported. By default, this is set to True.
conflict_handlerSpecifies the handling ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.