The Python Tutorial

September 30, 2013

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.


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.


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.

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.

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.

--- EOF ---