Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9375492

Browse files
committed
#9112: document error() and exit() methods of ArgumentParser.
1 parent 0036bcf commit 9375492

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

Doc/library/argparse.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,6 @@ printing it:
16631663
information about the arguments registered with the :class:`ArgumentParser`.
16641664

16651665

1666-
16671666
Partial parsing
16681667
^^^^^^^^^^^^^^^
16691668

@@ -1709,6 +1708,20 @@ Customizing file parsing
17091708
yield arg
17101709

17111710

1711+
Exiting methods
1712+
^^^^^^^^^^^^^^^
1713+
1714+
.. method:: ArgumentParser.exit(status=0, message=None)
1715+
1716+
This method terminates the program, exiting with the specified *status*
1717+
and, if given, it prints a *message* before that.
1718+
1719+
.. method:: ArgumentParser.error(message)
1720+
1721+
This method prints a usage message including the *message* to the
1722+
standard output and terminates the program with a status code of 2.
1723+
1724+
17121725
Upgrading optparse code
17131726
-----------------------
17141727

0 commit comments

Comments
 (0)