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.

Similar Reads

Installation

You can install docopt module in various ways, pip is one of the best ways to install docopt....

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....

Usage Pattern

docopt gives you strong control over your help page and it consists of the usage keyword which is case-insensitive that is followed by your program_name. A usage pattern can be described with various elements as mentioned below :...

Contact Us