查看python文档的方法

小编给大家分享一下查看python文档的方法,相信大部分人都还不怎么了解,因此分享这边文章给大家学习,希望大家阅读完这篇文章后大所收获,下面让我们一起去学习方法吧!

10年积累的网站设计、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有昭化免费网站建设让你可以放心的选择与我们合作。

查看文档是一个程序员的基本功,这里简单介绍几种查看Python文档的方法,下面以struct模块为例。

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文档的方法
网站路径:http://bzwzjz.com/article/pjspgg.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站制作 上市集团网站建设 重庆外贸网站建设 成都网站设计 专业网站设计 专业网站建设 成都营销网站建设 成都企业网站设计 网站建设 移动网站建设 成都网站建设 成都模版网站建设 营销型网站建设 网站建设方案 成都网站设计 成都网站建设 网站设计 企业网站设计 响应式网站设计 成都做网站建设公司 教育网站设计方案 重庆网站建设