Clear, practical technology insights About · Contact

Help () function in Python

The built-in help () function in Python is used to display documents and invoke the help system of modules, functions, classes, keywords ...

Author: Micah Soto2 minutes read
Table of Contents

The built-in help () function in Python is used to display documents and invoke the help system of modules, functions, classes, keywords .

The syntax for help () in Python

 help(object) 

The parameters of the help () function:

  1. object : the object you want to display information or call the help system.

The help () function is used for interaction, used in interpreters when you need help writing a program or using Python modules.

1. Parameter is an object passed to help () (not a string)

Try running the following command on Python shell:

 >>> help(list) 
 >>> help(dict) 
 >>> help(print) 
 >>> help([1, 2, 3]) 

2. Parameter is the string passed to help ()

If the parameter is passed as a string, the given string will be searched and returns the name of the module, function, class, method, keyword or document topic and the page showing the help system.

Try running the following command on Python shell:

 >>> help('random thing') 
 >>> help('print')) 
 >>> help('def') 
 >>> from math import * help('math.pow') 

3. No parameters passed to help ()

If no arguments are passed, the interactive help system will boot on the console.

 >>> help() 

You can then enter the object name you need to get help with writing programs or suggestions using Python modules. For example:

 help> True 
 help> 'print' 
 help > print 

To exit help () help and return to the interpreter, you need to enter quit and enter.

 help > quit 

See also: Built-in Python functions

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.