update argparse's doc of append action. (#92344)

This commit is contained in:
Hai Shi 2022-05-06 11:32:35 +08:00 committed by GitHub
parent 299692afd8
commit 301351c6a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -846,8 +846,10 @@ how the command-line arguments should be handled. The supplied actions are:
Namespace(foo=True, bar=False, baz=True) Namespace(foo=True, bar=False, baz=True)
* ``'append'`` - This stores a list, and appends each argument value to the * ``'append'`` - This stores a list, and appends each argument value to the
list. This is useful to allow an option to be specified multiple times. list. It is useful to allow an option to be specified multiple times.
Example usage:: If the default value is non-empty, the default elements will be present
in the parsed value for the option, with any values from the
command line appended after those default values. Example usage::
>>> parser = argparse.ArgumentParser() >>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', action='append') >>> parser.add_argument('--foo', action='append')