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...
🌐
Reddit
reddit.com › r/python › pydoc vs online documentation
r/Python on Reddit: pydoc vs online documentation
May 9, 2017 -

I have found that the pydoc documentation for libraries is often far less detailed than the online documentation. It drives me crazy that I cannot quickly review documentation via the commandline. I try to, but always end up having to jump onto the web for the full documentation. Is there a reason for this discrepancy?

I have a lot of experience with Perl where, in general, the perldoc documentation and any online documentation match, because they are generated from the same source. Is there a way to achieve that with Python?

Discussions

python - How do I create documentation with Pydoc? - Stack Overflow
I'm trying to create a document out of my module. I used pydoc from the command-line in Windows 7 using Python 3.2.3: python " \pydoc.py" -w myModule This led to my shell being More on stackoverflow.com
🌐 stackoverflow.com
Pydoc / Documentation Module
Does anyone have a recommendation for something along the lines of Pydoc that can be used to aggregate docstrings and the like into documentation pages? I tried Pydoc and it failed because of the magic commands in my repo. More on community.databricks.com
🌐 community.databricks.com
1
0
June 6, 2023
python - What does the Pydoc module do? - Stack Overflow
New to programming and python altogether. In the book I'm learning from, the author suggested I find out the purpose of Pydoc. I did a google search on it, and found a match (from Gnome Terminal) b... More on stackoverflow.com
🌐 stackoverflow.com
pydoc vs online documentation
They're completely different. pydoc is just showing embedded docstrings. That's not really intended to be the actual documentation, just a quick reference or brief summary. The actual documentation is typically written in a rich document management system like Sphinx, which makes it available in a number of formats, like PDF and HTML. I don't get the desire to read documentation from the terminal. I'll take a web browser any day over less. It's got hyperlinks, superior font rendering, better searching, flexible layout, etc. If the issue is that you don't want to go online, you can download the documentation for offline use. If the issue is that you want to be able to access it from the command line easily, then set up a shell alias that launches the browser at the desired URL. If you want to be able to grep all the documentation, you can still do that; the source is plain text (i.e. reStructuredText or Markdown or whatever the project uses.) More on reddit.com
🌐 r/Python
4
3
May 9, 2017
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
PyDoc - Visual Studio Marketplace
Extension for Visual Studio Code - Generates the docstring for functions and classes
🌐
W3Schools
w3schools.com › Python › ref_module_pydoc.asp
Python pydoc Module
The pydoc module generates and shows documentation for Python modules, classes, and functions.
🌐
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.
Find elsewhere
🌐
PyPI
pypi.org › project › pydoc-markdown
pydoc-markdown · PyPI
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).
🌐
GitHub
github.com › readthedocs › pydoc.io
GitHub - readthedocs/pydoc.io: A browser for Python project documentation · GitHub
A browser for Python project documentation . Contribute to readthedocs/pydoc.io development by creating an account on GitHub.
Author: readthedocs
🌐
Beautiful Soup
tedboy.github.io › python_stdlib › generated › pydoc.html
pydoc — Python Standard Library
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. If the argument contains a path segment delimiter (e.g.
🌐
Wikipedia
en.wikipedia.org › wiki › Pydoc
Pydoc - Wikipedia
August 11, 2025 - Pydoc is the standard documentation module for the programming language Python. 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, ...
🌐
Databricks Community
community.databricks.com › databricks community › data engineering › pydoc / documentation module
Solved: Pydoc / Documentation Module - Databricks Community - 4242
June 6, 2023 - Does anyone have a recommendation for something along the lines of Pydoc that can be used to aggregate docstrings and the like into documentation pages? I tried Pydoc and it failed because of the magi…
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
🌐
Sphinx
sphinx-doc.org
Sphinx — Sphinx documentation
Create intelligent and beautiful documentation with ease · 📝 Rich Text Formatting
🌐
Hexmos
hexmos.com › freedevtools › tldr › common › pydoc
Generate Python Documentation - pydoc | Online Free DevTools by Hexmos
Generate Python documentation with pydoc. Explore modules, classes, and functions offline. Easy access to Python docs. Free online tool, no registration required.
🌐
Hyperskill
hyperskill.org › learn › step › 18505
Pydoc
Hyperskill is an educational platform for learning programming and software development through project-based courses, that helps you secure a job in tech. Master Python, Java, Kotlin, and more with real-world coding challenges.