On this page
optparse.IndentedHelpFormatter
Prev: optparse.HelpFormatter | Up: optparse | Next: optparse.make_option
Rel: optparse.BadOptionError, optparse.check_choice, optparse.HelpFormatter, optparse.make_option
Ref: docs.python.org — optparse.IndentedHelpFormatter
Tags: #public #python3 #stdlib #optparse
Import
import optparse
from optparse import IndentedHelpFormatter
Signature & Overview
optparse.IndentedHelpFormatter(indent_increment=2, max_help_position=24, width=None, short_first=1)
Format help with indented section bodies.
Methods & Attributes
IndentedHelpFormatter.dedent(self)—IndentedHelpFormatter.dedentmethod/property.IndentedHelpFormatter.expand_default(self, option)—IndentedHelpFormatter.expand_defaultmethod/property.IndentedHelpFormatter.format_description(self, description)—IndentedHelpFormatter.format_descriptionmethod/property.IndentedHelpFormatter.format_epilog(self, epilog)—IndentedHelpFormatter.format_epilogmethod/property.IndentedHelpFormatter.format_heading(self, heading)—IndentedHelpFormatter.format_headingmethod/property.IndentedHelpFormatter.format_option(self, option)—IndentedHelpFormatter.format_optionmethod/property.IndentedHelpFormatter.format_option_strings(self, option)— Return a comma-separated list of option strings & metavariables.IndentedHelpFormatter.format_usage(self, usage)—IndentedHelpFormatter.format_usagemethod/property.IndentedHelpFormatter.indent(self)—IndentedHelpFormatter.indentmethod/property.IndentedHelpFormatter.set_long_opt_delimiter(self, delim)—IndentedHelpFormatter.set_long_opt_delimitermethod/property.IndentedHelpFormatter.set_parser(self, parser)—IndentedHelpFormatter.set_parsermethod/property.IndentedHelpFormatter.set_short_opt_delimiter(self, delim)—IndentedHelpFormatter.set_short_opt_delimitermethod/property.IndentedHelpFormatter.store_option_strings(self, parser)—IndentedHelpFormatter.store_option_stringsmethod/property.
Usage
import optparse
p = optparse.OptionParser(formatter=optparse.IndentedHelpFormatter())
assert "Usage:" in p.format_help()
Gotchas
- Default help formatter for
optparse.OptionParser.
REPL Inspect
from optparse import IndentedHelpFormatter
help(IndentedHelpFormatter)
Linked from
- tuts/python3/stdlib_module/optparse
- tuts/python3/stdlib_module/optparse/BadOptionError
- tuts/python3/stdlib_module/optparse/check_choice
- tuts/python3/stdlib_module/optparse/HelpFormatter
- tuts/python3/stdlib_module/optparse/make_option
- tuts/python3/stdlib_module/optparse/Option
- tuts/python3/stdlib_module/optparse/OptionConflictError
- tuts/python3/stdlib_module/optparse/OptionContainer
- tuts/python3/stdlib_module/optparse/OptionError
- tuts/python3/stdlib_module/optparse/OptionGroup
- tuts/python3/stdlib_module/optparse/OptionParser
- tuts/python3/stdlib_module/optparse/OptionValueError
- tuts/python3/stdlib_module/optparse/OptParseError
- tuts/python3/stdlib_module/optparse/TitledHelpFormatter
- tuts/python3/stdlib_module/optparse/Values
Related notes
- tuts/python3/stdlib_module/optparse/BadOptionError Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/check_choice Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/HelpFormatter Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/make_option Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/optparse/Option links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionConflictError links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionContainer links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionError links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionGroup links to this page; shared tags: #optparse, #stdlib