千锋教育-做有情怀、有良心、有品质的职业教育机构

400-811-9990
手机站
千锋教育

千锋学习站 | 随时随地免费学

千锋教育

扫一扫进入千锋手机站

领取全套视频
千锋教育

关注千锋学习站小程序
随时随地免费学习课程

上海
  • 北京
  • 郑州
  • 武汉
  • 成都
  • 西安
  • 沈阳
  • 广州
  • 南京
  • 深圳
  • 大连
  • 青岛
  • 杭州
  • 重庆
当前位置:沈阳千锋IT培训  >  技术干货  >  怎么查看python文档

怎么查看python文档

来源:千锋教育
发布人:xqq
时间: 2023-11-13 03:04:29

查看文档是一个程序员的基本功,这里简单介绍几种查看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

<:little-endian,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培训机构:千锋教育。

声明:本站稿件版权均属千锋教育所有,未经许可不得擅自转载。

猜你喜欢LIKE

pythontime模块的时间格式

2023-11-14

python怎样使用read读取不同类型文件

2023-11-14

python装饰属性的方法

2023-11-14

最新文章NEW

pythonsys模块有哪些用法

2023-11-14

python开发环境是什么

2023-11-14

pythoninsert函数是什么

2023-11-14

相关推荐HOT

更多>>

快速通道 更多>>

最新开班信息 更多>>

网友热搜 更多>>