跳转至

尚未翻译

本页面尚未翻译成中文,因此显示英文原文。 帮助翻译

pydoc Module

The pydoc module generates automatic documentation for Python modules from their docstrings, providing CLI and GUI interfaces.

Complexity Reference

Operation Time Space Notes
Generate docs O(n) O(n) n = module objects
Format text O(n) O(n) n = docstring length

Generating Documentation

Command-Line Help

import pydoc

# Get help text - O(n)
help_text = pydoc.render_doc('os')
print(help_text)

# Or from command line:
# python -m pydoc os

Serving Documentation

# Start documentation server - O(1) setup
python -m pydoc -p 8000
# Access at http://localhost:8000