Python 3 reference · Built-in Functions

Python help() Function

Show the built-in help for a function, class, module or keyword: its signature and documentation. Mostly used in the REPL.

Python 3 Since 3.0

Syntax

help()
help(request)

Parameters

ParameterDescription
request optional An object, or a string naming a module, keyword or topic.

Return value

None; the help text is printed.

Examples

Help for your own functionTry it yourself
def area(width, height):
    """Return the area of a rectangle."""
    return width * height

help(area)

Output

Help on function area:

area(width, height)
    Return the area of a rectangle.
Read a docstring directlyTry it yourself
print(len.__doc__)  # the same documentation, as a string

Output

Return the number of items in a container.

Good to know

In the REPL, help() with no argument starts an interactive help system; type quit to leave. Write docstrings (the first string in a function or class) so help() has something useful to show.

Version history

VersionChange
Python 3.0Added