@@ -744,16 +744,12 @@ how the command-line arguments should be handled. The supplied actions are:
744
744
>>> parser.parse_args('--foo --bar'.split())
745
745
Namespace(foo=True, bar=False, baz=True)
746
746
747
- * ``'append' `` - This stores a list, and appends each argument value to the
748
- list. It is useful to allow an option to be specified multiple times.
749
- If the default value is non-empty, the default elements will be present
750
- in the parsed value for the option, with any values from the
751
- command line appended after those default values. Example usage::
747
+ * ``'append' `` - This appends each argument value to a list.
748
+ It is useful for allowing an option to be specified multiple times.
749
+ If the default value is a non-empty list , the parsed value will start
750
+ with the default list's elements and any values from the command line
751
+ will be appended after those default values. Example usage::
752
752
753
- >>> parser = argparse.ArgumentParser()
754
- >>> parser.add_argument('--foo', action='append')
755
- >>> parser.parse_args('--foo 1 --foo 2'.split())
756
- Namespace(foo=['1', '2'])
757
753
>>> parser = argparse.ArgumentParser()
758
754
>>> parser.add_argument('--foo', action='append', default=['0'])
759
755
>>> parser.parse_args('--foo 1 --foo 2'.split())
0 commit comments