We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
argparse
append
1 parent a936af9 commit dae00d8Copy full SHA for dae00d8
Doc/library/argparse.rst
@@ -754,6 +754,10 @@ how the command-line arguments should be handled. The supplied actions are:
754
>>> parser.add_argument('--foo', action='append')
755
>>> parser.parse_args('--foo 1 --foo 2'.split())
756
Namespace(foo=['1', '2'])
757
+ >>> parser = argparse.ArgumentParser()
758
+ >>> parser.add_argument('--foo', action='append', default=['0'])
759
+ >>> parser.parse_args('--foo 1 --foo 2'.split())
760
+ Namespace(foo=['0', '1', '2'])
761
762
* ``'append_const'`` - This stores a list, and appends the value specified by
763
the const_ keyword argument to the list; note that the const_ keyword
0 commit comments