Home  >  Article  >  Backend Development  >  How to read the help file in python

How to read the help file in python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-20 15:11:013825browse

How to read the help file in python

How to read the help file in python? Here are several ways to view help documents in Python:

help()
The help function is a built-in function of Python
Function prototype : help([object])
can help us learn more about the object.
can be either a module or a function in the module
For example: help(math) / help(math. sin)

dir()
The dir function is a built-in function of python
Function prototype: dir([object])
can help us get the object Most relevant properties.
You need to import the corresponding module first before you can view the properties and methods of the module.
For example:

import math
dir(math)

doc
There is a wonderful feature in python, document strings, which are also called DocStrings.
For example:

math.doc

View the built-in module sys.bultin_modulenames

For example:

import sys
sys.bultin_modulenames

pydoc
python -m pydoc raw_input (view function) View pydoc usage under cmd

pydoc -h

The above is the detailed content of How to read the help file in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn