Another thing that people may find useful...make sure to leave off ".py" from your module name. For example, if you are trying to generate documentation for 'original' in 'original.py':

yourcode_dir$ pydoc -w original.py
no Python documentation found for 'original.py'

yourcode_dir$ pydoc -w original
wrote original.html
Answer from K.S. on Stack Overflow
🌐
Python
docs.python.org › 3 › library › pydoc.html
pydoc — Documentation generator and online help system ...
Source code: Lib/pydoc.py The pydoc module automatically generates documentation from Python modules. The documentation can be presented as pages of text on the console, served to a web browser, or...
🌐
W3Schools
w3schools.com › python › ref_module_pydoc.asp
Python pydoc Module
The pydoc module generates and shows documentation for Python modules, classes, and functions.

Another thing that people may find useful...make sure to leave off ".py" from your module name. For example, if you are trying to generate documentation for 'original' in 'original.py':

yourcode_dir$ pydoc -w original.py
no Python documentation found for 'original.py'

yourcode_dir$ pydoc -w original
wrote original.html
Answer from K.S. on Stack Overflow
🌐
Beautiful Soup
tedboy.github.io › python_stdlib › generated › pydoc.html
pydoc — Python Standard Library
Calling help(thing) on a Python object documents the object. ... Run “pydoc <name>” to show documentation on something. <name> may be the name of a function, module, package, or a dotted reference to a class or function within a module or module in a package.
🌐
Wikipedia
en.wikipedia.org › wiki › Pydoc
Pydoc - Wikipedia
August 11, 2025 - Similar to the functionality of Perldoc within Perl and Javadoc within Java, Pydoc allows Python programmers to access Python's documentation help files, generate text and HTML pages with documentation specifics, and find the appropriate module for a particular job.
🌐
Python
docs.python.org › 3.9 › library › pydoc.html
pydoc — Documentation generator and online help system — Python 3.9.23 documentation
The built-in function help() invokes the online help system in the interactive interpreter, which uses pydoc to generate its documentation as text on the console. The same text documentation can also be viewed from outside the Python interpreter by running pydoc as a script at the operating ...
Find elsewhere
🌐
Dennis O'Keeffe
dennisokeeffe.com › blog › 2021-08-07-how-pydoc-helps-your-python-development
How PyDoc Helps Your Python Development
August 7, 2021 - -h pydoc - the Python documentation tool pydoc <name> ... Show text documentation on something. <name> 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 ...
🌐
Pythonology
pythonology.eu › how-to-use-pydoc-to-generate-documentation-in-python
how to use pyDoc to generate documentation in python? – pythonology
If you are a developer who writes code in Python, you might have heard of PyDoc. It is a tool that automatically generates documentation for your code based on the docstrings you write. (I am using the Thonny code editor for the video tutorial at the end of this page).
🌐
DataCamp
datacamp.com › tutorial › docstrings-python
Python Docstrings Tutorial : Examples & Format for Pydoc, Numpy, Sphinx Doc Strings | DataCamp
February 14, 2025 - As you learned that docstrings are accessible through the built-in Python __doc__ attribute and the help() function. You could also make use of the built-in module known as Pydoc, which is very different in terms of the features & functionalities it possesses when compared to the doc attribute and the help function.
Top answer
1 of 8
17

Pydoc is a help / documentation module for Python.

Use this on your Windows terminal to understand what a function in python does :

python -m pydoc <function>

eg.

python -m pydoc raw_input

If the documentation for a particular function is very long, use 'q' to get out of it.

e.g. in case of

python -m pydoc Tkinter
2 of 8
7

Pydoc module in Python can be used to generate documentation in the form of html pages or even on the console

python -m pydoc 

This command gives options like view the pydoc for a file, -k search for different libraries, -p allows to open a page in web browser to view python packages, -g provides a graphical interface for looking documentation, -w writes an html output. Below are the sample commands that you can fire for testing.

python -m pydoc yourpythonfile
python -m pydoc -k ftplib
python -m pydoc -p 314
python -m pydoc -w file

I have created two sample files in a directory file1.py and file2.py which has a simple code with a single line of comment.

def f2m(ft):
    """ Return the number of meters eq to feet """
    return 0.30 * ft

One way to see the comment of the files is to simply write below in the same file and you can run python file.py and it would show the comments.

help(f2m)

Other way to see this is to write the command

python -m pydoc file1

One more way to see the comments in an html page by typing this command and exporting it to html

python -m pydoc -w <dir>

If you have multiple python files and if you want to generate HTML into separate folder then simple shell commands can do the job. Below code generates a folder 'htmldocs' and then generates html and moves them to this new folder. If you open any one at the right hand top corner you can see index option through which you can navigate through other pages.

mkdir -p htmldocs
pydoc -w `find . -name '*.py'`
mv *.html htmldocs
🌐
Python Module of the Week
pymotw.com › 2 › pydoc
pydoc – Online help for Python modules - Python Module of the Week
Now available for Python 3! Buy the book! ... The pydoc module imports a Python module and uses the contents to generate help text at runtime.
🌐
Python
docs.python.org › 3.4 › library › pydoc.html
26.1. pydoc — Documentation generator and online help system — Python 3.4.10 documentation
June 16, 2019 - This document is for an old version of Python that is no longer supported. You should upgrade, and read the Python documentation for the current stable release. ... The pydoc module automatically generates documentation from Python modules.
🌐
GitHub
github.com › python › cpython › blob › main › Lib › pydoc.py
cpython/Lib/pydoc.py at main · python/cpython
"""Generate Python documentation in HTML or text for interactive use. ... Run "pydoc <name>" to show documentation on something.
Author: python
🌐
YouTube
youtube.com › pythonology
How to Use Pydoc: A Guide for Generating Python Documentation - YouTube
PyDoc is a module that helps you create documentation for your Python code. In this video, you will learn how to use Pydoc to write docstrings, generate HTM...
Published: November 26, 2023
Views: 5K
🌐
Reddit
reddit.com › r/learnpython › today i learned - pydoc, the python documentation tools
r/learnpython on Reddit: Today I Learned - pydoc, the python documentation tools
February 15, 2016 -

https://docs.python.org/3.3/library/pydoc.html#module-pydoc

The pydoc module automatically generates documentation from Python modules. The documentation can be presented as pages of text on the console, served to a Web browser, or saved to HTML files.

Instead of using help(keyword) in the interpreter, You can view the same doc from command line with pydoc keyword or pydoc3 keyword, which presents a man page like doc of the given keyword

pydoc -g launches the gui version, requires python-tk package,

pydoc -p port launches a local server serving documentation in html format with search function

pydoc3 -b is same as pydoc -p but also launches default broswer with the page opened

Windows folks may want to add the python lib directory to environment path to invoke pydoc from command line, do note that they are .py files

edit: formatting

🌐
Saddlebackcss
saddlebackcss.github.io › tutorials › python › basic › 2016 › 01 › 14 › python-basics-4
Python Basics 4: Docstrings, pydoc, doctest, and Function Annotations
January 14, 2016 - It can be executed using the pydoc command (or, equivalently, python -m pydoc), followed by the name of the module or script file. If the script is in the current directory, use either its module name (ie its file name without the .py extension) or prefix its filename with ./ (or .\ on Windows).
🌐
Medium
dennisokeeffe.medium.com › how-pydoc-helps-your-python-development-df0b186ad96e
How PyDoc Helps Your Python Development | by Dennis O'Keeffe | Medium
September 13, 2021 - As a simple starter, we can use PyDoc to explore the documentation of the datetime module from the command line. To do so, we can run python -m pydoc [module] and we should see the output based on the doc strings for each of the functions in the module.
🌐
PyPI
pypi.org › project › pydoc-markdown
pydoc-markdown · PyPI
Create Python API documentation in Markdown format. ... Pydoc-Markdown is a tool to create Python API documentation in Markdown format.
🌐
Package Control
packagecontrol.io › packages › PyDOC
PyDOC - Packages - Package Control
Select a built-in Python object in your editor text then enter the key binding to open the command palette (see description above in the Sublime Package Control section). Type 'pydoc' and then select either Python 2 Doc Search (PyDOC), Python 3 Doc Search (PyDOC),Numpy Doc Search (PyDOC), SciPy Doc Search (PyDOC), Matplotlib Doc Search (PyDOC), or TensorFlow Doc Search (PyDOC).