What is help() Fuction in Python

help() function is another Python’s built-in function. Similar to dir(), the help() function also has one optional argument, which means it is not mandatory to pass the argument. By using help() function, it is easy to receive assistance in building Python programs.

The users need only input the name of any keyword, topic, or module. To exit or go back to the interpreter, simply type quit. The return values of help() functions are divided into three main parts as follow:

  • No argument: the interactive help system starts on the interpreter console.
  • String as argument: the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console.
  • Any other kind of object: a help page on the object is generated.

Python: Difference between dir() and help()

In Python two commonly used functions for exploring objects, modules, and their attributes are dir() and help(). While both are useful for gaining insights into Python code, they serve distinct purposes. This article aims to clarify the differences between dir() and help() and guide developers on when and how to use each effectively.

Similar Reads

What is dir() in Python

It is one of the built-in functions that is available in Python which has one optional argument. This built-in function will return the list of names in the current local scope. The dir() function syntax is dir(object). The object can be a function, module, string, tuple, dictionary, etc....

Python dir() Examples

Example 1: dir() Without Argument...

What is help() Fuction in Python

...

Python help() Function Example

...

Difference Between dir() and help() in Python

...