首页 > 代码库 > 函数帮助查询

函数帮助查询

1.help()进入帮助文档

 

1 >>> help()
2 
3 Welcome to Python 3.5s help utility!
4 
5 If this is your first time using Python, you should definitely check out
6 the tutorial on the Internet at http://docs.python.org/3.5/tutorial/.

2.查看所有模块

 1 help> modules
 2 
 3 Please wait a moment while I gather a list of all available modules...
 4 
 5 AutoComplete        _pyio               filecmp             pyscreeze
 6 AutoCompleteWindow  _random             fileinput           pytweening
 7 ......        
 8 
 9 Enter any module name to get more help.  Or, type "modules spam" to search
10 for modules whose name or summary contain the string "spam".

3.导入模块后,查看模块使用方法

 1 >>> import math
 2 >>> help(math)
 3 Help on built-in module math:
 4 
 5 NAME
 6     math
 7 
 8 DESCRIPTION
 9     This module is always available.  It provides access to the
10     mathematical functions defined by the C standard.
11 
12 FUNCTIONS
13     acos(...)
14         acos(x)
15 
16         Return the arc cosine (measured in radians) of x.
17 ...

4.查看模块下所有函数名称,前提要import

1 >>> dir(math)
2 [__doc__, __loader__, __name__,...]
3 >>> 

5.查看模块下的函数用法

1 >>> help(math.sin)
2 Help on built-in function sin in module math:
3 
4 sin(...)
5     sin(x)
6 
7     Return the sine of x (measured in radians).

 

 

函数帮助查询