Python标准库1 介绍 Introduction 尝试翻译

时间:2022-01-31 22:36:37

The “Python library” contains several different kinds of components.

Python标准库 包含几个不同的组件。

It contains data types that would normally be considered part of the “core” of a language, such as numbers and lists. For these types, the Python language core defines the form of literals and places some constraints on their semantics, but does not fully define the semantics. (On the other hand, the language core does define syntactic properties like the spelling and priorities of operators.)

它们包括 被认为是 语言核心部分的 数据类型,像数字和列表.对这些类型, Python语言内核 定义了 简单的形式 ,对其语法作了一些约束,但不是完全定义它们的语法。 (另一方面,语言核心的确定义了一些语法特性,如操作符的拼写和优先级.)

The library also contains built-in functions and exceptions — objects that can be used by all Python code without the need of an import statement. Some of these are defined by the core language, but many are not essential for the core semantics and are only described here.

标准库还包括内置的函数和表达式。 即那些可以被直接使用,而不需要 import 语句另外导入的对象。其中一些被核心语言定义,但大部分对核心语法而言并不是必须的,只是在这里介绍一下。

The bulk of the library, however, consists of a collection of modules. There are many ways to dissect this collection. Some modules are written in C and built in to the Python interpreter; others are written in Python and imported in source form. Some modules provide interfaces that are highly specific to Python, like printing a stack trace; some provide interfaces that are specific to particular operating systems, such as access to specific hardware; others provide interfaces that are specific to a particular application domain, like the World Wide Web. Some modules are available in all versions and ports of Python; others are only available when the underlying system supports or requires them; yet others are available only when a particular configuration option was chosen at the time when Python was compiled and installed.

其实 大量的库集合在一起组成了一些模块。可以从不同的角度来剖析这些集合。 一些模块用C写成,内置在Python解释器中。其他的模块就是Python写的,以Python源码的形式导入。一些模块提供的是针对Python的接口,如打印一个堆栈的信息。一些模块是针对特定的操作系统,像连接特定的硬件的。还有一些模块是针对特定应用领域的,如互联网。许多的模块在全部的Python版本和端口中都可以使用。而另外一些只有在系统支持和需要的情况下才可以使用。还有一些需要在编译和安装Python的时候 配置了相应的选项才可以使用。

This manual is organized “from the inside out:” it first describes the built-in data types, then the built-in functions and exceptions, and finally the modules, grouped in chapters of related modules. The ordering of the chapters as well as the ordering of the modules within each chapter is roughly from most relevant to least important.

这个手册原来叫“从里面到外面”:它首先介绍了内置的数据类型,然后内置的函数和表达式,最后是按照相关性组织的模块章节。章节的顺序是按照章节中的模块大致从常用到不那么重要来排列的。

This means that if you start reading this manual from the start, and skip to the next chapter when you get bored, you will get a reasonable overview of the available modules and application areas that are supported by the Python library. Of course, you don’t haveto read it like a novel — you can also browse the table of contents (in front of the manual), or look for a specific function, module or term in the index (in the back). And finally, if you enjoy learning about random subjects, you choose a random page number (see module random) and read a section or two. Regardless of the order in which you read the sections of this manual, it helps to start with chapter Built-in Functions, as the remainder of the manual assumes familiarity with this material.

Let the show begin!

这意味着,你可以从头读这个手册,当你烦了的时候就跳到下一章,这样对于Python标准库都提供了哪些模块,能支持哪些应用能有一个大概了解。当然,也不用像读小说地一样读它,你可以先看看目录(在手册最前面),寻找特定的函数,模块,或者在搜索框(在后面)里面查找一下。最后,如果你享受随机选择一个主题去阅读的方式,你可以先选择一个随机页码,读上一两段。 无论你想怎么读, 还是建议从内置函数 这一章开始读 ,原因是 其他的章节都是在假设 你已经了解 内置函数 这一章的基础上介绍的。

让我们开始吧!


同时我也更新在这个网站上

http://python.usyiyi.cn/python_278/library/intro.html