Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
da8e11ac
Commit
da8e11ac
authored
Jan 19, 2012
by
Sandro Tosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #13605: more meaningful example + fixes
parent
16bd0b44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Doc/library/argparse.rst
Doc/library/argparse.rst
+5
-5
No files found.
Doc/library/argparse.rst
View file @
da8e11ac
...
...
@@ -840,16 +840,16 @@ values are:
usage: PROG [-h] foo [foo ...]
PROG: error: too few arguments
* ``argparse.REMAINDER``. All the remaining command-line arguments
are gathered into a lits. This is commonly useful for command line
utilities that dispatch
to other command line utilities.
* ``argparse.REMAINDER``. All the remaining command-line arguments
are gathered
into a list. This is commonly useful for command line utilities that dispatch
to other command line utilities.
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--foo')
>>> parser.add_argument('command')
>>> parser.add_argument('args', nargs=argparse.REMAINDER)
>>> print parser.parse_args('--foo B
XX YY
ZZ'.split())
Namespace(args=['
YY', 'ZZ'], command='XX
', foo='B')
>>> print parser.parse_args('--foo B
cmd --arg1 XX
ZZ'.split())
Namespace(args=['
--arg1', 'XX', 'ZZ'], command='cmd
', foo='B')
If the ``nargs`` keyword argument is not provided, the number of arguments consumed
is determined by the action_. Generally this means a single command-line argument
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment