Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,17 @@ If the ``nargs`` keyword argument is not provided, the number of arguments consu
is determined by the action_. Generally this means a single command-line argument
will be consumed and a single item (not a list) will be produced.

* ``'...'``. The remaining command-line args are gathered into a list,
including optional arguments. If there are no remaining arguments,
an empty list is returned. For example::

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('cmd')
>>> parser.add_argument('args', nargs='...')
>>> parser.parse_args('script.sh -v -n'.split())
Namespace(cmd=['script.sh'], args=['-v', '-n'])
>>> parser.parse_args('script.sh'.split())
Namespace(cmd=['script.sh'], args=[])

.. _const:

Expand Down