operating system services see alsowinreg ( optparse the optparse module provides high-level support for processing unix-style command-line options supplied in sys argv simple example of using the module is found in use of optparse primarily focuses on the optionparser class optionparser([**args]creates new command option parser and returns an optionparser instance variety of optional keyword arguments can be supplied to control configuration these keyword arguments are described in the following listkeyword argument description specifies whether or not special help option (--help and -his supported by defaultthis is set to true conflict_handler specifies the handling of conflicting command-line options may be set to either 'error(the default valueor 'resolvein 'errormodean optparse optionconflicterror exception will be raised if conflicting option strings are added to the parser in 'resolvemodeconflicts are resolved so that options added later take priority howeverearlier options may still be available if they were added under multiple names and no conflicts exist for at least one of the names description string that provides description of the program for display during help this string will automatically be reformatted to fit the screen when displayed formatter instance of an optparse helpformatter class used to format text when printing help may be either optparse indentedhelpformatter (the defaultor optparse titledhelpformatter option_class the python class that' used to hold information about each command-line option the default class is optparse option option_list list of options used to populate the parser by defaultthis list is emptyand options are added using the add_option(method instead if suppliedthis list contains objects of type option prog the program name used to replace '%progin help text usage the usage string that' printed when the --help option is used or incorrect options are passed the default value is the string '%prog [options]'where the '%progkeyword gets replaced with either the value of os path basename (sys argv[ ]or the value of the prog keyword argument (if suppliedthe value optparse suppress_usage can be given to suppress the usage message entirely version version string that' printed when the -version option is supplied by defaultversion is none and no --version option is added when this string is supplied-version is automatically added the special keyword '%progis replaced by the program name add_help_option lib fl ff