查看文档是一个程序员的基本功,这里简单介绍几种查看Python文档的方法,下面以struct模块为例。
创新互联公司是专业的定边网站建设公司,定边接单;提供网站设计、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行定边网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
1.help
在交互模式下,help函数是获取文档的好帮手,使用非常简单。
>>> import struct >>> help(struct) Help on module struct: NAME struct DESCRIPTION Functions to convert between Python values and C structs. Python bytes objects are used to hold the data representing the C struct and also as format strings (explained below) to describe the layout of data in the C struct. The optional first format char indicates byte order, size and alignment: @: native order, size & alignment (default) =: native order, std. size & alignment <: little-endian, std. size & alignment >: big-endian, std. size & alignment !: same as > The remaining chars indicate types of args and must match exactly; these can be preceded by a decimal repeat count: x: pad byte (no data); c:char; b:signed byte; B:unsigned byte; ?: _Bool (requires C99; if not available, char is used instead) h:short; H:unsigned short; i:int; I:unsigned int;
2.__doc__
__doc__是每个对象都有的属性,其存放了对象文档。
3.离线文档
安装Python时会自带一个chm格式的离线文档Python documention,该文档的信息比较全。
4.离线模块文档
Python针对模块还有一个单独的文档,该文档在浏览器中查看。
5.在线文档。
Python学习网,大量免费的学习资源,欢迎学习!
当前标题:创新互联Python教程:怎么查看python文档
文章路径:http://www.mswzjz.cn/qtweb/news18/34918.html
攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能