Python help() Example | help() Function In Python Tutorial

Python help() is an inbuilt method that is used for interactive use. The help() function is used to get documentation of the specified module, class, function, variables, etc. The help() method is generally used with the python interpreter console to get details about python objects.

Python help() Method

It’s recommended to try it in your interpreter when you need help to write the Python program and use  Python modules.

Syntax

help([object])

Parameters

  • object: It can be any object for which we wan to get help.

Return

  • It returns the object's info.

Python help() Function Example

Example 1: 

# Python help() function example  
# Calling function  
info = help() # No argument  
# Displaying result  
print(info)  

Output:

Welcome to Python 3.5's help utility!

Example 2: 

# Python help() function example  
# Calling function  
info = help(1) # integer value  
# Displaying result  
print(info)  

Output:

Help on int object:

class int(object)
 |  int(x=0) -> integer
 |  int(x, base=10) -> integer
 |  
 |  Methods defined here:
 |  
 |  __abs__(self, /)
 |      abs(self)
 |  
 |  __add__(self, value, /)
 |      Return self+value.
 |  
 |  __and__(self, value, /)
 |      Return self&value.

#python #python help

Python help() Example | help() Function In Python Tutorial
1.50 GEEK