help()
help([object]) Returns:
None · Added in v3.0 · Updated March 13, 2026 · Built-in Functions help documentation interactive built-in pydoc
The help() function invokes Python’s built-in help system. When called without arguments, it starts an interactive help session where you can browse documentation for any available object. When called with an argument, it displays help documentation for that specific object.
Syntax
help([object])
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
object | object | — | An object to get help for. Can be a module, class, function, keyword, or any object with a __doc__ attribute. If omitted, starts the interactive help system. |
Examples
Getting help for a specific object
# Get help for a built-in function
help(print)
# Displays: Help on built-in function print in module builtins:
# print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
# ...
# Get help for a module
help(os)
# Displays: Help on module os:
# Get help for a class
help(list)
# Displays: Help on class list in module builtins:
# ...
# Get help for a method
help(list.append)
# Displays: Help on method descriptor:
# ...
Getting help in different ways
# Using help with a string searches for topics
help("Modules")
# Lists all available modules
help("Keywords")
# Lists all Python keywords
help("statements")
# Lists available statements
Using help in scripts
# Capture help output to a string
import io
import sys
# Redirect stdout to capture help output
old_stdout = sys.stdout
sys.stdout = io.StringIO()
help(sum)
# Get the captured output
help_output = sys.stdout.getvalue()
sys.stdout = old_stdout
# Print first 500 characters
print(help_output[:500])
Interactive help patterns
# Explore unknown modules
import json
# List all functions in a module
print([item for item in dir(json) if not item.startswith('_')])
# ['JSONDecodeError', 'JSONDecoder', 'JSONEncoder', 'dump', 'dumps', 'load', 'loads']
# Then get help on specific functions
help(json.load)
help(json.dump)
Creating custom help for your classes
class MyClass:
'''This is my class documentation.'''
def __init__(self, value):
'''Initialize MyClass with a value.'''
self.value = value
def get_value(self):
'''Return the stored value.'''
return self.value
# Your docstrings become help text
help(MyClass)
help(MyClass.__init__)
help(MyClass.get_value)
Errors
The help system is read-only and doesn’t raise exceptions for unsupported objects—it simply displays whatever documentation exists (or “No Python documentation found” if none exists).
# Help on None
help(None)
# Displays: No Python documentation found for 'None'
# Help on object without docstring
class NoDoc:
pass
help(NoDoc)
# Displays minimal help (no docstring available)