知行编程网知行编程网  2022-12-27 01:30 知行编程网 隐藏边栏  13 
文章评分 0 次,平均分 0.0
导语: 本文主要介绍了关于怎么查看python文档的相关知识,包括python文件打开,以及python保存的文件在哪里找这些编程知识,希望对大家有参考作用。

如何查看python文档

查看文档是程序员的一项基本技能。下面介绍几种查看 Python 文档的方法。下面以 struct 模块为例。

1.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.在线文档。

,大量免费的学习资源,欢迎学习!

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

知行编程网
知行编程网 关注:1    粉丝:1
这个人很懒,什么都没写
扫一扫二维码分享