怎么查看python文档
查看文档是一个程序员的基本功,这里简单介绍几种查看Python文档的方法,下面以struct模块为例。
1.help
在交互模式下,help函数是获取文档的好帮手,使用非常简单。
>>>importstruct
>>>help(struct)
Helponmodulestruct:
NAME
struct
DESCRIPTION
FunctionstoconvertbetweenPythonvaluesandCstructs.
PythonbytesobjectsareusedtoholdthedatarepresentingtheCstruct
andalsoasformatstrings(explainedbelow)todescribethelayoutofdata
intheCstruct.
Theoptionalfirstformatcharindicatesbyteorder,sizeandalignment:
@:nativeorder,size&alignment(default)
=:nativeorder,std.size&alignment
:big-endian,std.size&alignment
!:sameas>
Theremainingcharsindicatetypesofargsandmustmatchexactly;
thesecanbeprecededbyadecimalrepeatcount:
x:padbyte(nodata);c:char;b:signedbyte;B:unsignedbyte;
?:_Bool(requiresC99;ifnotavailable,charisusedinstead)
h:short;H:unsignedshort;i:int;I:unsignedint;
2.__doc__
__doc__是每个对象都有的属性,其存放了对象文档。
3.离线文档
安装Python时会自带一个chm格式的离线文档Pythondocumention,该文档的信息比较全。
4.离线模块文档
Python针对模块还有一个单独的文档,该文档在浏览器中查看。
5.在线文档。
以上内容为大家介绍了怎么查看python文档,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:开发教育。
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!