help() displays documentation about various Python objects including modules, functions, classes, and keywords. If no argument is passed, the interactive help utility starts up on the command line.
object parameter is not passed to the
help() function, the interactive help utility will be started.
object is a string that matches a valid module, function, class, keyword, or other topic, a documentation page will be displayed. For other kinds of objects (like a tuple), the
help() function will show its documentation page as well.
help() function without an argument, the following output is returned:
Welcome to Python 3's help utility!If this is your first time using Python, you should definitely check outthe tutorial on the internet at https://docs.python.org/3.10/tutorial/.Enter the name of any module, keyword, or topic to get help on writingPython programs and using Python modules. To quit this help utility andreturn to the interpreter, just type "quit".To get a list of available modules, keywords, symbols, or topics, type"modules", "keywords", "symbols", or "topics". Each module also comeswith a one-line summary of what it does; to list the modules whose nameor summary contain a given string such as "spam", type "modules spam".help>
The following shows how the
help() function provides information about Python’s built-in
This produces the following output:
print(...)print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)Prints the values to a stream, or to sys.stdout by default.Optional keyword arguments:file: a file-like object (stream); defaults to the current sys.stdout.sep: string inserted between values, default a space.end: string appended after the last value, default a newline.flush: whether to forcibly flush the stream.
The following example is runnable and shows how the
help() function can be applied to different kinds of objects, including user-defined classes:
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.