pydoc
View Python module documentation
TLDR
SYNOPSIS
pydoc [-k keyword] [-p port] [-b] [-w] [name...]
DESCRIPTION
pydoc is Python's built-in documentation tool that displays module documentation generated from docstrings and introspection. It can show documentation for modules, classes, functions, and keywords in the terminal, search across all installed modules with -k, or generate static HTML files with -w.The -p flag starts a local HTTP documentation server that provides a browsable interface to all installed Python modules, and -b opens this server automatically in the default web browser. pydoc is part of the Python standard library and provides the same functionality as the interactive help() function.The PAGER environment variable controls which program is used for terminal display. The BROWSER environment variable controls which browser is used with -b.
PARAMETERS
name
Module, package, class, function, or keyword to document.-k keyword
Search synopsis lines of all available modules for keyword.-p port
Start HTTP documentation server on the given port.-b
Start HTTP server and open a web browser to its page.-w name
Write HTML documentation for the module to a file in the current directory.-n host
Hostname for the HTTP server (default: localhost). Python 3.11+.
CAVEATS
Documentation quality depends on the presence of docstrings in the module source. Importing a module to inspect it may execute module-level code. The -n flag for specifying the server hostname requires Python 3.11+.
HISTORY
pydoc has been part of the Python standard library since Python 2.1 (2001). It was written by Ka-Ping Yee as a built-in documentation viewer, providing the same functionality as the interactive help() function.
