LinuxCommandLibrary

pydoc

Display offline Python documentation.

TLDR

Print documentation on a subject (Python keyword, topic, function, module, package, etc.)

$ pydoc [subject]
copy


Start an HTTP server on an arbitrary unused port and open a [b]rowser to see the documentation
$ pydoc -b
copy


Display help
$ pydoc
copy

Help

pydoc - the Python documentation tool 

pydoc  ... 
    Show text documentation on something.   may be the name of a 
    Python keyword, topic, function, module, or package, or a dotted 
    reference to a class or function within a module or module in a 
    package.  If  contains a '/', it is used as the path to a 
    Python source file to document. If name is 'keywords', 'topics', 
    or 'modules', a listing of these things is displayed. 

pydoc -k  
    Search for a keyword in the synopsis lines of all available modules. 

pydoc -n  
    Start an HTTP server with the given hostname (default: localhost). 

pydoc -p  
    Start an HTTP server on the given port on the local machine.  Port 
    number 0 can be used to get an arbitrary unused port. 

pydoc -b 
    Start an HTTP server on an arbitrary unused port and open a web browser 
    to interactively browse documentation.  This option can be used in 
    combination with -n and/or -p. 

pydoc -w  ... 
    Write out the HTML documentation for a module to a file in the current 
    directory.  If  contains a '/', it is treated as a filename; if 
    it names a directory, documentation is written for all the contents. 

Copied to clipboard