标签:
Python文档资源:
| 形式 | 角色 | 
| #注释 | 文件中的文档 | 
| dir函数 | 对象中可用属性的列表 | 
| 文档字符串:__doc__ | 附加在对象上的文件中的文档 | 
| PyDoc:help函数 | 对象的交互帮助 | 
| PyDoc:HTML报表 | 浏览器中的模块文档 | 
| 标准手册 | 正式的语言和库的说明 | 
| 网站资源 | 在线教程、例子等 | 
| 出版的图书 | 商业参考书籍 | 
1、#注释
#注释只能从源代码文件中看到,若要查看#注释信息,只需要获取相应的模块文件即可。
2、Dir函数
获取对象内可用所有属性列表的简单方式(如,对象的方法以及简单的数据项),它能够调用任何有属性的对象。


""" Module documentation Words Go Here """ spam=40 def square(x): """ function documentation can we have your liver then? """ return x **2 class employee: "class documentation" pass print(square(4)) print(square.__doc__)
>>> import docstrings 16 function documentation can we have your liver then? >>> print(docstrings.__doc__) Module documentation Words Go Here >>> print(docstrings.square.__doc__) function documentation can we have your liver then? >>> print(docstrings.employee.__doc__) class documentation






标签:
原文地址:http://www.cnblogs.com/yl153/p/5968344.html