diff options
author | Sandro Tosi <sandro.tosi@gmail.com> | 2012-01-19 21:22:35 (GMT) |
---|---|---|
committer | Sandro Tosi <sandro.tosi@gmail.com> | 2012-01-19 21:22:35 (GMT) |
commit | cb21227407f20ba41d81b3e82f7ae76b115a64b1 (patch) | |
tree | f9354c5c0ad6c14a1dcb29fa68ad7ffdd03a98ed /Doc | |
parent | 10f047dca85baf37eaa69a13e5a98c2d27a41094 (diff) | |
download | cpython-cb21227407f20ba41d81b3e82f7ae76b115a64b1.zip cpython-cb21227407f20ba41d81b3e82f7ae76b115a64b1.tar.gz cpython-cb21227407f20ba41d81b3e82f7ae76b115a64b1.tar.bz2 |
Issue #13605: more meaningful example + fixes
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/argparse.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 6e8bff1..0b0e9d3 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -838,16 +838,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 |