Python Function Reference

help

Print help on a function, class, module or another object.

Python 3.13
help([request])

Parameters

requestAnyoptional
The object to get help on, such as len or str.split; a string can name a module or a keyword.

Return value

Nothing (None); the help text is printed.

Examples

Help on your own function

Python 3.13
def area(width, height):
    """Return the area of a rectangle."""
    return width * height


help(area)
Help on function area in module __main__:

area(width, height)
    Return the area of a rectangle.

Help on a built-in function

Python 3.13
help(len)
Help on built-in function len in module builtins:

len(obj, /)
    Return the number of items in a container.

Details

Help is built from the signature and the documentation string (docstring), so write docstrings for your own functions. Without an argument, help() starts interactive help that waits for keyboard input, so programs pass a specific object. Help on a whole module, such as help(math), is very long.

See also

Where to learn