导语:
本文主要介绍了关于python文档怎么看的相关知识,包括python框架有哪些,以及python安装numpy这些编程知识,希望对大家有参考作用。
查看文档是程序员的一项基本技能。以下是查看 Python 文档的几种方法。下面以struct模块为例。
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;
__doc__
__doc__是每个对象都有的属性,其存放了对象文档。
>>> import struct
>>> struct.__doc__
"Functions to convert between Python values and C structs.\nPython bytes objects are used to hold the data representing the C struct\nand also as format string
s (explained below) to describe the layout of data\nin the C struct.\n\nThe optional first format char indicates byte order, size and alignment:\n @: native o
rder, size & alignment (default)\n =: native order, std. size & alignment\n <: little-endian, std. size & alignment\n >: big-endian, std. size & alignment\n
!: same as >\n\nThe remaining chars indicate types of args and must match exactly;\nthese can be preceded by a decimal repeat count:\n x: pad byte (no data)
; c:char; b:signed byte; B:unsigned byte;\n ?: _Bool (requires C99; if not available, char is used instead)\n h:short; H:unsigned short; i:int; I:unsigned in
t;\n l:long; L:unsigned long;
离线文档
安装Python的时候会自带一个chm格式的离线文档Python文档,文档的信息比较全。
Python 还有一个单独的模块文档,可以在浏览器中查看。
在浏览器打开https://docs.python.org/3.4/
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ python保存后无法打开文件的原因是什么?08/15
- ♥ Python3编码是如何实现文件操作的?12/08
- ♥ mat在python中是什么意思?09/03
- ♥ python中8个常用内置函数详解12/03
- ♥ 20个有用的python代码片段(2)12/28
- ♥ Python如何构建项目11/19
内容反馈