diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 5d0a13e0c8f4f7..d4c5f521251b6b 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1447,12 +1447,12 @@ it exits and prints the error along with a usage message:: >>> # invalid option >>> parser.parse_args(['--bar']) usage: PROG [-h] [--foo FOO] [bar] - PROG: error: no such option: --bar + PROG: error: unrecognized arguments: --bar >>> # wrong number of arguments >>> parser.parse_args(['spam', 'badger']) usage: PROG [-h] [--foo FOO] [bar] - PROG: error: extra arguments found: badger + PROG: error: unrecognized arguments: badger Arguments containing ``-`` @@ -1489,7 +1489,7 @@ there are no options in the parser that look like negative numbers:: >>> # negative number options present, so -2 is an option >>> parser.parse_args(['-2']) usage: PROG [-h] [-1 ONE] [foo] - PROG: error: no such option: -2 + PROG: error: unrecognized arguments: -2 >>> # negative number options present, so both -1s are options >>> parser.parse_args(['-1', '-1'])