Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 78ef1b6

Browse filesBrowse 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
Copy full SHA for 78ef1b6

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎Doc/library/argparse.rst

Copy file name to clipboardExpand all lines: Doc/library/argparse.rst
+2-2Lines changed: 2 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.