Initialization
docopt is most commonly used to display the help messages and it is invoked with -h or –help option. You can import and call this module with the following command.
from docopt import docopt docopt(doc, argv = None , version = None , help = True , options = False ) |
Parameters of the module is as shown below :
- doc : It is a docstring (__doc__) that contains the help message.
- argv : It is an optional argument vector contains list of strings.
- version : It is an optional argument mentioning the version of the program.
- help : Responsible for displaying the help message. It is True by default.
- options_first : This doesn’t allow the mixing of positional arguments and optional arguments. By default it is False.
Docopt module in Python
Docopt is a command line interface description module. It helps you define a interface for a command-line application and generates parser for it. The interface message in docopt is a formalized help message.
Contact Us