the python tutorial #python指南

作者: 赵敏是程序媛 | 来源:发表于2019-08-12 20:17 被阅读27次

    The Python Tutorial

    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优美的语法和动态类型,加上易于理解的特性,使得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, https://www.python.org/, 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网站https://www.python.org/免费获得源代码或二进制形式,并且可以免费分发。类似的网站也包含了很多免费的第三方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编写的语言)编程的新函数和数据类型很用以扩展。

    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 LibraryThe 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.

    对于标准对象和模块的描述,请看The Python Standard Library(python标准库)。The Python Language Reference (python语言参考)给出了一个更正式的本语言的介绍。想使用C或者C++写扩展内容,可以阅读Extending and Embedding the Python Interpreter (扩展和嵌入python解释器)及Python/C API Reference Manual(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模块和程序,并且已经准备好学习更多的在The Python Standard Library(python标准库)中描述的各种python库模块。

    The Glossary is also worth going through.

    专业术语表也值得认真阅读。

    [if !supportLists]· [endif]1. Whetting Your Appetite引起你的兴趣

    [if !supportLists]· [endif]2. Using the Python Interpreter使用python解释器

    [if !supportLists]o [endif]2.1. Invoking the Interpreter调用解释器

    [if !supportLists]§ [endif]2.1.1. Argument Passing参数传递

    [if !supportLists]§ [endif]2.1.2. Interactive Mode交互模块

    [if !supportLists]o [endif]2.2. The Interpreter and Its Environment解释器和它的环境

    [if !supportLists]§ [endif]2.2.1. Source Code Encoding源码编译

    [if !supportLists]· [endif]3. An Informal Introduction to Python非正式的介绍python

    [if !supportLists]o [endif]3.1. Using Python as a Calculator使用python作为一个计算器

    [if !supportLists]§ [endif]3.1.1. Numbers数字

    [if !supportLists]§ [endif]3.1.2. Strings字符串

    [if !supportLists]§ [endif]3.1.3. Lists列表

    [if !supportLists]o [endif]3.2. First Steps Towards Programming编程的第一步

    [if !supportLists]· [endif]4. More Control Flow Tools更多的控制流工具

    [if !supportLists]o [endif]4.1. if Statements#if声明

    [if !supportLists]o [endif]4.2. for Statements#for声明

    [if !supportLists]o [endif]4.3. The range() Function#range()函数

    [if !supportLists]o [endif]4.4. break and continue Statements, and else Clauses on Loops#break和continue声明,循环中的else语句

    [if !supportLists]o [endif]4.5. pass Statements#pass声明

    [if !supportLists]o [endif]4.6. Defining Functions定义函数

    [if !supportLists]o [endif]4.7. More on Defining Functions定义的函数

    [if !supportLists]§ [endif]4.7.1. Default Argument Values 定义参数值

    [if !supportLists]§ [endif]4.7.2. Keyword Arguments关键字参数

    [if !supportLists]§ [endif]4.7.3. Arbitrary Argument Lists任意参数列表

    [if !supportLists]§ [endif]4.7.4. Unpacking Argument Lists未打包参数列表

    [if !supportLists]§ [endif]4.7.5. Lambda Expressions#Lambda表达式

    [if !supportLists]§ [endif]4.7.6. Documentation Strings文档字符

    [if !supportLists]§ [endif]4.7.7. Function Annotations函数注释

    [if !supportLists]o [endif]4.8. Intermezzo: Coding Style插曲:编译风格

    [if !supportLists]· [endif]5. Data Structures 数据结构

    [if !supportLists]o [endif]5.1. More on Lists列表扩展

    [if !supportLists]§ [endif]5.1.1. Using Lists as Stacks使用列表作为栈

    [if !supportLists]§ [endif]5.1.2. Using Lists as Queues使用列表作为队列

    [if !supportLists]§ [endif]5.1.3. List Comprehensions列表的理解

    [if !supportLists]§ [endif]5.1.4. Nested List Comprehensions嵌套列表的理解

    [if !supportLists]o [endif]5.2. The del statement#del声明

    [if !supportLists]o [endif]5.3. Tuples and Sequences元组和序列

    [if !supportLists]o [endif]5.4. Sets集合

    [if !supportLists]o [endif]5.5. Dictionaries字典

    [if !supportLists]o [endif]5.6. Looping Techniques循环技术

    [if !supportLists]o [endif]5.7. More on Conditions条件扩展

    [if !supportLists]o [endif]5.8. Comparing Sequences and Other Types比较序列和其他类型

    [if !supportLists]· [endif]6. Modules模块

    [if !supportLists]o [endif]6.1. More on Modules模块扩展

    [if !supportLists]§ [endif]6.1.1. Executing modules as scripts 作为脚本执行模块

    [if !supportLists]§ [endif]6.1.2. The Module Search Path 模块搜索路径

    [if !supportLists]§ [endif]6.1.3. “Compiled” Python files #编译python文件

    [if !supportLists]o [endif]6.2. Standard Modules标准模块

    [if !supportLists]o [endif]6.3. The dir() Function#dir()函数

    [if !supportLists]o [endif]6.4. Packages

    [if !supportLists]§ [endif]6.4.1. Importing * From a Package#引入*从一个包(这种python语法,用于模块间的引用)

    [if !supportLists]§ [endif]6.4.2. Intra-package References内嵌包的参考文档

    [if !supportLists]§ [endif]6.4.3. Packages in Multiple Directories多目录中的包

    [if !supportLists]· [endif]7. Input and Output输入输出

    [if !supportLists]o [endif]7.1. Fancier Output Formatting受欢迎的输出格式

    [if !supportLists]§ [endif]7.1.1. Formatted String Literals格式化字符文字

    [if !supportLists]§ [endif]7.1.2. The String format() Method#字符的format()方法

    [if !supportLists]§ [endif]7.1.3. Manual String Formatting手动的字符格式化

    [if !supportLists]§ [endif]7.1.4. Old string formatting老的字符格式化

    [if !supportLists]o [endif]7.2. Reading and Writing Files读和写文件

    [if !supportLists]§ [endif]7.2.1. Methods of File Objects文件对应的方法

    [if !supportLists]§ [endif]7.2.2. Saving structured data with json使用json保存结构化数据

    [if !supportLists]· [endif]8. Errors and Exceptions错误与异常

    [if !supportLists]o [endif]8.1. Syntax Errors语法错误

    [if !supportLists]o [endif]8.2. Exceptions异常

    [if !supportLists]o [endif]8.3. Handling Exceptions异常处理

    [if !supportLists]o [endif]8.4. Raising Exceptions挂起异常

    [if !supportLists]o [endif]8.5. User-defined Exceptions用户定义的异常

    [if !supportLists]o [endif]8.6. Defining Clean-up Actions定义清除(恢复)行为

    [if !supportLists]o [endif]8.7. Predefined Clean-up Actions预定义清除(恢复)行为

    [if !supportLists]· [endif]9. Classes

    [if !supportLists]o [endif]9.1. A Word About Names and Objects一个关于名称和对象的词

    [if !supportLists]o [endif]9.2. Python Scopes and Namespacespython领域和命名空间

    [if !supportLists]§ [endif]9.2.1. Scopes and Namespaces Example领域和命令空间举例

    [if !supportLists]o [endif]9.3. A First Look at Classes初识类

    [if !supportLists]§ [endif]9.3.1. Class Definition Syntax类的定义语法

    [if !supportLists]§ [endif]9.3.2. Class Objects类对象

    [if !supportLists]§ [endif]9.3.3. Instance Objects实例对象

    [if !supportLists]§ [endif]9.3.4. Method Objects方法对象

    [if !supportLists]§ [endif]9.3.5. Class and Instance Variables类和实例变量

    [if !supportLists]o [endif]9.4. Random Remarks随机摘要

    [if !supportLists]o [endif]9.5. Inheritance继承

    [if !supportLists]§ [endif]9.5.1. Multiple Inheritance多重继承

    [if !supportLists]o [endif]9.6. Private Variables私有变量

    [if !supportLists]o [endif]9.7. Odds and Ends概率和结束

    [if !supportLists]o [endif]9.8. Iterators迭代器

    [if !supportLists]o [endif]9.9. Generators生成器

    [if !supportLists]o [endif]9.10. Generator Expressions生成器解释

    [if !supportLists]· [endif]10. Brief Tour of the Standard Library标准库的简单介绍

    [if !supportLists]o [endif]10.1. Operating System Interface操作系统接口

    [if !supportLists]o [endif]10.2. File Wildcards文件通配符

    [if !supportLists]o [endif]10.3. Command Line Arguments命令行参数

    [if !supportLists]o [endif]10.4. Error Output Redirection and Program Termination错误输出重定向和程序终止

    [if !supportLists]o [endif]10.5. String Pattern Matching字符模式匹配

    [if !supportLists]o [endif]10.6. Mathematics数学运算

    [if !supportLists]o [endif]10.7. Internet Access链接互联网

    [if !supportLists]o [endif]10.8. Dates and Times数据和时间

    [if !supportLists]o [endif]10.9. Data Compression数据压缩

    [if !supportLists]o [endif]10.10. Performance Measurement性能测量

    [if !supportLists]o [endif]10.11. Quality Control质量控制

    [if !supportLists]o [endif]10.12. Batteries Included #包含的Batterries

    [if !supportLists]· [endif]11. Brief Tour of the Standard Library — Part II标准库的简介第二部分

    [if !supportLists]o [endif]11.1. Output Formatting输出格式

    [if !supportLists]o [endif]11.2. Templating模板

    [if !supportLists]o [endif]11.3. Working with Binary Data Record Layouts与二进制数据记录层工作

    [if !supportLists]o [endif]11.4. Multi-threading多线程

    [if !supportLists]o [endif]11.5. Logging日志

    [if !supportLists]o [endif]11.6. Weak References弱引用

    [if !supportLists]o [endif]11.7. Tools for Working with Lists使用列表的工具

    [if !supportLists]o [endif]11.8. Decimal Floating Point Arithmetic十进制浮点运算

    [if !supportLists]· [endif]12. Virtual Environments and Packages虚拟环境和包

    [if !supportLists]o [endif]12.1. Introduction介绍

    [if !supportLists]o [endif]12.2. Creating Virtual Environments创建虚拟环境

    [if !supportLists]o [endif]12.3. Managing Packages with pip使用pip管理包

    [if !supportLists]· [endif]13. What Now?现状

    [if !supportLists]· [endif]14. Interactive Input Editing and History Substitution交互式输入编辑和历史替换

    [if !supportLists]o [endif]14.1. Tab Completion and History Editing完成建和历史编辑

    [if !supportLists]o [endif]14.2. Alternatives to the Interactive Interpreter交互式解释器的替代物

    [if !supportLists]· [endif]15. Floating Point Arithmetic: Issues and Limitations浮点运算:问题与限制

    [if !supportLists]o [endif]15.1. Representation Error引用错误

    [if !supportLists]· [endif]16. Appendix附录

    [if !supportLists]o [endif]16.1. Interactive Mode交互式模块

    [if !supportLists]§ [endif]16.1.1. Error Handling错误处理

    [if !supportLists]§ [endif]16.1.2. Executable Python Scripts执行python脚本

    [if !supportLists]§ [endif]16.1.3. The Interactive Startup File交互式启动文件

    [if !supportLists]§ [endif]16.1.4. The Customization Modules定制化模块

    0��b|��QoD

    相关文章

      网友评论

        本文标题:the python tutorial #python指南

        本文链接:https://www.haomeiwen.com/subject/ldepjctx.html