The Help function is a built-in function of Python (Python's built-in functions can be called directly without import), which is a python-brought function that can be used at any time. What the help function can do, how to use the helps function to see the use of functions in the Python module, and what to look for when using the Help function, here's a quick word.
The role of the Help () function
When you use Python to write code, you often use Python's self-contained functions or modules, and some infrequently used functions or modules are not useful, and you need the help function to view the assistance.
Notice here that the Help () function is a detailed description of the purpose of the function or module, and the Dir () function is to see what is in the function or module, and the output is a list of methods.
Ii. How to use the Help function to view the use of functions in a Python module
Help () to fill in the parameters in parentheses, the operation method is very simple. For example:
Copy Code code as follows:
>>> Help (' dir ')
Help on built-in function dir in module Builtins:
Dir (...)
Dir ([object])-> list of strings
If called without a argument, return to the names in the current scope.
Else, return a alphabetized list of names comprising (some of) the Attribut
Es
Of the given object, and of attributes reachable from it.
If the object supplies a method named __dir__, it would be used; otherwise
The default Dir () logic is used and returns:
For a module object:the module ' s attributes.
For a class object:its attributes, and recursively the attributes
of its bases.
For all other object:its attributes, its class ' s attributes, and
Recursively the attributes of its class ' s base classes.
Iii. use the Help function to view the examples of assistance
When writing the Help () function using the method, say, fill in the parameters in parentheses, and here you should pay attention to the form of the parameter:
1, see the help of a module
Copy Code code as follows:
It then opens the Help document for this module back
2. View Help for a data type
Copy Code code as follows:
Ways to return strings and detailed instructions
Copy Code code as follows:
>>>a = [1,2,3]
>>>help (a)
Then Help (a) Opens the list action method
Copy Code code as follows:
Will show help for the Append method of the list