Skip to content

Commit 78ef1b6

Browse files
[3.9] Fix error in argparse documentation example (GH-17399) (GH-21992)
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
1 parent 672d8b9 commit 78ef1b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/argparse.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,8 @@ keyword argument to :meth:`~ArgumentParser.add_argument`::
11621162
>>> parser.parse_args(['--foo', 'BAR'])
11631163
Namespace(foo='BAR')
11641164
>>> parser.parse_args([])
1165-
usage: argparse.py [-h] [--foo FOO]
1166-
argparse.py: error: option --foo is required
1165+
usage: [-h] --foo FOO
1166+
: error: the following arguments are required: --foo
11671167

11681168
As the example shows, if an option is marked as ``required``,
11691169
:meth:`~ArgumentParser.parse_args` will report an error if that option is not

0 commit comments

Comments
 (0)