PyDocs

Nav

Command-line interface libraries

ArgumentParser.add_argument_group

argparse

method of ArgumentParser (source) Deprecated 3.11
  • ArgumentParser.add_argument_group(title=None, description=None, *[, argument_default][, conflict_handler])
Deprecated since 3.11, removed in 3.14. Calling add_argument_group() on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance.
By default, ArgumentParser groups command-line arguments into “positional arguments” and “options” when displaying help messages. When there is a better conceptual grouping of arguments than this default one, appropriate groups can be created using the add_argument_group() method:
1 Example
>>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)
>>> group = parser.add_argument_group('group')
>>> group.add_argument('--foo', help='foo help')
>>> group.add_argument('bar', help='bar help')
>>> parser.print_help()
usage: PROG [--foo FOO] bar

group:
  bar    bar help
  --foo FOO  foo help
from the Python docs
See Also
No see-alsos for argparse/ArgumentParser.add_argument_group
0 Notes
No notes for ArgumentParser.add_argument_group