Built-in Functions and Types

help()

Show interactive documentation about an object or named topic. With no argument, start an interactive help session; with a supplied object or topic name, display documentation. The site module normally installs help into builtins. The displayed content can vary by version and environment; strings are interpreted as topic names, not printed as plain text.

Formal Syntax & Structure

python syntaxpython
help()help(request)

Parameters & Attributes

NameTypeDescription
requestobject | strObject to inspect or documentation topic; omit for interactive help.

Return Value

None

Displays documentation rather than returning its text.

Working Example

Example Snippetpython
# Local fixture: capture help text without an interactive pager.from io import StringIOfrom contextlib import redirect_stdout
buffer = StringIO()with redirect_stdout(buffer):    result = help(len)print("len" in buffer.getvalue())print(result is None)
Python Reference