Python 入门指南




The Python Tutorial Python 入门指南

Release: 3.1
Date: September 05, 2009

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.

你可以很容易的使用C或C++(其他可以通过C调用的语言)为Python解释器扩展新函数和数据类型。 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 Library Reference document. The Python Reference Manual 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. 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 Library Reference.

本手册不会尝试涵盖Python的全部知识和每个特性,甚至不会涵盖所有常用的特性。 相反的,它介绍了Python中许多最引人瞩目的特性,并且会给你一个关于语言特色和风格的认识。 读完之后,你将能够阅读和编写Python模块或程序,并为以后使用Python库参考手册继续学习诸多Python模块库做好准备。

The Glossary is also worth going through.