2019-04-08 23:22:26 +08:00

1 line
3.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="body" role="main"><div class="section" id="introduction"><h1><span class="yiyi-st" id="yiyi-9">1. </span><span class="yiyi-st" id="yiyi-10">简介</span></h1><p><span class="yiyi-st" id="yiyi-11">“Python标准库”包含几个不同类型的组件。</span></p><p><span class="yiyi-st" id="yiyi-12">如数组和列表,这些数据类型通常被认为是编程语言的“核心”。</span><span class="yiyi-st" id="yiyi-13">对这些类型, Python语言内核定义了其文字形式 ,对其语法作了一些约束,但不是完全定义它们的语法。 </span><span class="yiyi-st" id="yiyi-14">(另一方面,语言核心确实定义了一些语法特性,如操作符的拼写和优先级。)</span></p><p><span class="yiyi-st" id="yiyi-15">库还包含内置函数和异常 — — 不需要 <a class="reference internal" href="../reference/simple_stmts.html#import"><code class="xref std std-keyword docutils literal"><span class="pre">import</span></code></a> 语句,就可以使用的对象。</span><span class="yiyi-st" id="yiyi-16">其中的一部分是由核心语言定义的,但是大多数对于语义并不是必须的,因此只进行简单描述。</span></p><p><span class="yiyi-st" id="yiyi-17">然而,库的大部分是由一系列模块组成。</span><span class="yiyi-st" id="yiyi-18">有很多方法来剖析这一系列模块。</span><span class="yiyi-st" id="yiyi-19">某些模块是用 c 语言编写,内嵌于 Python 解释器中;其余都是用 Python 编写的并以源代码的形式导入。</span><span class="yiyi-st" id="yiyi-20">某些模块提供了为 Python专门设计的接口像打印堆栈跟踪;一些模块提供特定的操作系统的接口,如访问特定的硬件;其他提供了特定的应用程序的接口,像万维网的接口。</span><span class="yiyi-st" id="yiyi-21">一些模块提供了Python的所有版本和端口 ;有些则需要系统支持或引入;还有一些只在 Python 编译和安装时被选中才可用。</span></p><p><span class="yiyi-st" id="yiyi-22">这个手册组织方式为“从内到外”: 它首先介绍了内置的函数,数据类型和异常, 最后介绍模块和相关模块的分组章节</span></p><p><span class="yiyi-st" id="yiyi-23">这意味着如果你开始时从头开始阅读这本手册当感到厌烦时跳到下一章节你会得到一份合理的概述这个概述是关于被python库支持的可用模块和应用领域。</span><span class="yiyi-st" id="yiyi-24">当然,您没有必要<em></em>像读一本小说一样(从头到尾的)阅读它, - 您也可以在目录(在手册前面)或索引(在手册后面)中寻找一个特定的功能,模块或术去浏览。</span><span class="yiyi-st" id="yiyi-25">如果你想要学习关于随机模块的主题,你可以选择随机模块主题的页码 (见模块 <a class="reference internal" href="random.html#module-random" title="random: Generate pseudo-random numbers with various common distributions."><code class="xref py py-mod docutils literal"><span class="pre">random</span></code></a> 阅读。</span><span class="yiyi-st" id="yiyi-26">不论您按照什么顺序阅读这份手册, <a class="reference internal" href="functions.html#built-in-funcs"><span>内置函数</span></a>章节有助于开始你的阅读,手册的其余部分会假定您熟悉这一章节。</span></p><p><span class="yiyi-st" id="yiyi-27">好戏即将开始!</span></p></div></div>