The Python Tutorial Python 教程 ¶

Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
Python 是一种易于学习、功能强大的编程语言。它具有高效的高级数据结构和简单但有效的面向对象编程方法。Python 优雅的语法和动态类型,以及它的解释性质,使它成为许多领域中脚本编写和快速应用开发的理想语言。

The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python web site,, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
Python 解释器和广泛的标准库可以在 Python 官网上以源代码或二进制形式免费获取,并可自由分发。该网站还提供许多免费的第三方 Python 模块、程序和工具的发行版和指针,以及额外的文档。

The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.
Python 解释器可以很容易地通过在 C 或 C++(或其他可从 C 调用的语言)中实现新的函数和数据类型进行扩展。Python 也适用作可定制应用程序的扩展语言。

This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well.
本教程以非正式的方式向读者介绍了 Python 语言和系统的基本概念和特性。最好准备一个 Python 解释器以进行实践,但所有示例都是独立的,因此教程也可以离线阅读。

For a description of standard objects and modules, see The Python Standard Library. The Python Language Reference gives a more formal definition of the language. To write extensions in C or C++, read Extending and Embedding the Python Interpreter and Python/C API Reference Manual. There are also several books covering Python in depth.
有关标准对象和模块的描述,请参阅 Python 标准库。Python 语言参考提供了对语言的更正式定义。要编写 C 或 C++扩展,请阅读《扩展和嵌入 Python 解释器》和《Python/C API 参考手册》。还有几本深入讲解 Python 的书籍。

This tutorial does not attempt to be comprehensive and cover every single feature, or even every commonly used feature. Instead, it introduces many of Python’s most noteworthy features, and will give you a good idea of the language’s flavor and style. After reading it, you will be able to read and write Python modules and programs, and you will be ready to learn more about the various Python library modules described in The Python Standard Library.
本教程不试图全面覆盖每一个功能,甚至不包括每一个常用功能。相反,它介绍了许多 Python 最值得注意的特性,并且会给你一个对语言风格和风味的良好理解。阅读完后,你将能够阅读和编写 Python 模块和程序,并且你将准备好学习更多关于 Python 标准库中描述的各种 Python 库模块的知识。

The Glossary is also worth going through.