diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-11-18 06:06:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 06:06:19 (GMT) |
commit | 04c79d6088a22d467f04dbe438050c26de22fa85 (patch) | |
tree | 4066a5d93a0569adb371e229724f59be78470ffe /Doc/library/argparse.rst | |
parent | 4544e78ec4558b75bf95e5b7dfc1b5bbb07ae5f0 (diff) | |
download | cpython-04c79d6088a22d467f04dbe438050c26de22fa85.zip cpython-04c79d6088a22d467f04dbe438050c26de22fa85.tar.gz cpython-04c79d6088a22d467f04dbe438050c26de22fa85.tar.bz2 |
bpo-38678: Improve argparse example in tutorial (GH-17207)
Diffstat (limited to 'Doc/library/argparse.rst')
-rw-r--r-- | Doc/library/argparse.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 9a1cf3a..f8e3918 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -810,10 +810,12 @@ how the command-line arguments should be handled. The supplied actions are: example, this is useful for increasing verbosity levels:: >>> parser = argparse.ArgumentParser() - >>> parser.add_argument('--verbose', '-v', action='count') + >>> parser.add_argument('--verbose', '-v', action='count', default=0) >>> parser.parse_args(['-vvv']) Namespace(verbose=3) + Note, the *default* will be ``None`` unless explicitly set to *0*. + * ``'help'`` - This prints a complete help message for all the options in the current parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the |