June 2019
Beginner to intermediate
770 pages
19h 24m
English
The option to display the version number is so common that there's a special shortcut to show us the version information:
parser.add_argument( "-V", "--version", action="version", version=__version__ )
This example assumes that we have a global __version__= "3.3.2" module somewhere in the file. This special action="version" will have the side effect of exiting the program after displaying the version information.
Read now
Unlock full access