diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 475cac70291e9a..61aef7b82fa731 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -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: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy