Skip to content

Commit e77547b

Browse files
[3.8] Fix error in argparse documentation example (pythonGH-17399) (pythonGH-21990)
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
1 parent 66e9c2a commit e77547b

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
@@ -1123,8 +1123,8 @@ keyword argument to :meth:`~ArgumentParser.add_argument`::
11231123
>>> parser.parse_args(['--foo', 'BAR'])
11241124
Namespace(foo='BAR')
11251125
>>> parser.parse_args([])
1126-
usage: argparse.py [-h] [--foo FOO]
1127-
argparse.py: error: option --foo is required
1126+
usage: [-h] --foo FOO
1127+
: error: the following arguments are required: --foo
11281128

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

0 commit comments

Comments
 (0)