We use the library module, pydoc, to produce HTML documentation from Python code. It turns out that we're using it when we evaluate help() in interactive Python. This function produces the text mode documentation with no markup.
When we use pydoc to produce the documentation, we'll use it in one of the following ways:
- Prepare text-mode documentation files and view them with command-line tools such as more or less.
- Run an HTTP server and browse the documentation directly.
We can run the following command-line tool to prepare the text-based documentation for a module:
pydoc somemodule
We can also use the following code:
python3 -m pydoc somemodule
Either command will create text documentation based on the Python code. The output will be displayed with programs such as less (on Linux or macOS) or more (on Windows), which paginate the long...