“Python/docs/3.9/tutorial/index”的版本间差异

来自菜鸟教程
Python/docs/3.9/tutorial/index
跳转至:导航、​搜索
(autoload)
 
(Page commit)
 
第1行: 第1行:
 +
{{DISPLAYTITLE:Python 教程 — Python 文档}}
 
<div id="the-python-tutorial" class="section">
 
<div id="the-python-tutorial" class="section">
  
 
<span id="tutorial-index"></span>
 
<span id="tutorial-index"></span>
= The Python Tutorial =
+
= Python 教程 =
  
Python is an easy to learn, powerful programming language. It has efficient
+
Python 是一种易于学习、功能强大的编程语言。 它具有高效的高级数据结构和简单但有效的面向对象编程方法。 Python 优雅的语法和动态类型,加上它的解释性质,使其成为大多数平台上许多领域的脚本编写和快速应用程序开发的理想语言。
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
+
Python 解释器和广泛的标准库可以从 Python 网站 https://www.python.org/ 以源代码或二进制形式免费提供给所有主要平台,并且可以免费分发。 该站点还包含许多免费的第三方 Python 模块、程序和工具以及其他文档的分发和指针。
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.
 
  
The Python interpreter is easily extended with new functions and data types
+
Python 解释器很容易使用 C C++(或其他可从 C 调用的语言)实现的新函数和数据类型进行扩展。 Python 也适合作为可定制应用程序的扩展语言。
implemented in C or C++ (or other languages callable from C). Python is also
 
suitable as an extension language for customizable applications.
 
  
This tutorial introduces the reader informally to the basic concepts and
+
本教程非正式地向读者介绍了 Python 语言和系统的基本概念和特性。 有一个 Python 解释器有助于实践经验,但所有示例都是独立的,因此本教程也可以离线阅读。
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 [[../../library/index#library-index|<span class="std std-ref">The Python Standard Library</span>]].
+
有关标准对象和模块的说明,请参阅 [[../../library/index#library-index|Python 标准库]] [[../../reference/index#reference-index|Python 语言参考]] 给出了更正式的语言定义。 要使用 C C++ 编写扩展,请阅读 [[../../extending/index#extending-index|Extending and Embedding the Python Interpreter]] [[../../c-api/index#c-api-index|Python/C API Reference Manual]]。 还有几本书深入介绍了 Python。
[[../../reference/index#reference-index|<span class="std std-ref">The Python Language Reference</span>]] gives a more formal definition of the language. To write
 
extensions in C or C++, read [[../../extending/index#extending-index|<span class="std std-ref">Extending and Embedding the Python Interpreter</span>]] and
 
[[../../c-api/index#c-api-index|<span class="std std-ref">Python/C API Reference Manual</span>]]. There are also several books covering Python in depth.
 
  
This tutorial does not attempt to be comprehensive and cover every single
+
本教程并不试图全面覆盖每一个功能,甚至每个常用功能。 相反,它介绍了 Python 的许多最值得注意的特性,并且会让您对这门语言的风格和风格有一个很好的了解。 阅读后,您将能够读写 Python 模块和程序,并且您将准备好进一步了解 [[../../library/index#library-index|Python 标准库]] 中描述的各种 Python 库模块。
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 [[../../library/index#library-index|<span class="std std-ref">The Python Standard Library</span>]].
 
  
The [[../../glossary#glossary|<span class="std std-ref">Glossary</span>]] is also worth going through.
+
[[../../glossary#glossary|词汇表]]也值得一读。
  
 
<div class="toctree-wrapper compound">
 
<div class="toctree-wrapper compound">
  
* [[../appetite|1. Whetting Your Appetite]]
+
* [[../appetite|1. 开胃]]
* [[../interpreter|2. Using the Python Interpreter]]
+
* [[../interpreter|2. 使用 Python 解释器]]
** [[../interpreter#invoking-the-interpreter|2.1. Invoking the Interpreter]]
+
** [[../interpreter#invoking-the-interpreter|2.1. 调用解释器]]
*** [[../interpreter#argument-passing|2.1.1. Argument Passing]]
+
*** [[../interpreter#argument-passing|2.1.1. 参数传递]]
*** [[../interpreter#interactive-mode|2.1.2. Interactive Mode]]
+
*** [[../interpreter#interactive-mode|2.1.2. 交互模式]]
** [[../interpreter#the-interpreter-and-its-environment|2.2. The Interpreter and Its Environment]]
+
** [[../interpreter#the-interpreter-and-its-environment|2.2. 口译员及其环境]]
*** [[../interpreter#source-code-encoding|2.2.1. Source Code Encoding]]
+
*** [[../interpreter#source-code-encoding|2.2.1. 源代码编码]]
* [[../introduction|3. An Informal Introduction to Python]]
+
* [[../introduction|3. Python 的非正式介绍]]
** [[../introduction#using-python-as-a-calculator|3.1. Using Python as a Calculator]]
+
** [[../introduction#using-python-as-a-calculator|3.1. 使用 Python 作为计算器]]
*** [[../introduction#numbers|3.1.1. Numbers]]
+
*** [[../introduction#numbers|3.1.1. 数字]]
*** [[../introduction#strings|3.1.2. Strings]]
+
*** [[../introduction#strings|3.1.2. 字符串]]
*** [[../introduction#lists|3.1.3. Lists]]
+
*** [[../introduction#lists|3.1.3. 列表]]
** [[../introduction#first-steps-towards-programming|3.2. First Steps Towards Programming]]
+
** [[../introduction#first-steps-towards-programming|3.2. 编程的第一步]]
* [[../controlflow|4. More Control Flow Tools]]
+
* [[../controlflow|4. 更多控制流工具]]
** [[../controlflow#if-statements|4.1. <code>if</code> Statements]]
+
** [[../controlflow#if-statements|4.1. <code>if</code> 声明]]
** [[../controlflow#for-statements|4.2. <code>for</code> Statements]]
+
** [[../controlflow#for-statements|4.2. <code>for</code> 声明]]
** [[../controlflow#the-range-function|4.3. The <code>range()</code> Function]]
+
** [[../controlflow#the-range-function|4.3. <code>range()</code> 功能]]
** [[../controlflow#break-and-continue-statements-and-else-clauses-on-loops|4.4. <code>break</code> and <code>continue</code> Statements, and <code>else</code> Clauses on Loops]]
+
** [[../controlflow#break-and-continue-statements-and-else-clauses-on-loops|4.4. <code>break</code> <code>continue</code> 语句,以及 <code>else</code> 循环子句]]
** [[../controlflow#pass-statements|4.5. <code>pass</code> Statements]]
+
** [[../controlflow#pass-statements|4.5. <code>pass</code> 声明]]
** [[../controlflow#defining-functions|4.6. Defining Functions]]
+
** [[../controlflow#defining-functions|4.6. 定义函数]]
** [[../controlflow#more-on-defining-functions|4.7. More on Defining Functions]]
+
** [[../controlflow#more-on-defining-functions|4.7. 有关定义函数的更多信息]]
*** [[../controlflow#default-argument-values|4.7.1. Default Argument Values]]
+
*** [[../controlflow#default-argument-values|4.7.1. 默认参数值]]
*** [[../controlflow#keyword-arguments|4.7.2. Keyword Arguments]]
+
*** [[../controlflow#keyword-arguments|4.7.2. 关键字参数]]
*** [[../controlflow#special-parameters|4.7.3. Special parameters]]
+
*** [[../controlflow#special-parameters|4.7.3. 特殊参数]]
**** [[../controlflow#positional-or-keyword-arguments|4.7.3.1. Positional-or-Keyword Arguments]]
+
**** [[../controlflow#positional-or-keyword-arguments|4.7.3.1. 位置或关键字参数]]
**** [[../controlflow#positional-only-parameters|4.7.3.2. Positional-Only Parameters]]
+
**** [[../controlflow#positional-only-parameters|4.7.3.2. 仅位置参数]]
**** [[../controlflow#keyword-only-arguments|4.7.3.3. Keyword-Only Arguments]]
+
**** [[../controlflow#keyword-only-arguments|4.7.3.3. 仅关键字参数]]
**** [[../controlflow#function-examples|4.7.3.4. Function Examples]]
+
**** [[../controlflow#function-examples|4.7.3.4. 函数示例]]
**** [[../controlflow#recap|4.7.3.5. Recap]]
+
**** [[../controlflow#recap|4.7.3.5. 回顾]]
*** [[../controlflow#arbitrary-argument-lists|4.7.4. Arbitrary Argument Lists]]
+
*** [[../controlflow#arbitrary-argument-lists|4.7.4. 任意参数列表]]
*** [[../controlflow#unpacking-argument-lists|4.7.5. Unpacking Argument Lists]]
+
*** [[../controlflow#unpacking-argument-lists|4.7.5. 解包参数列表]]
*** [[../controlflow#lambda-expressions|4.7.6. Lambda Expressions]]
+
*** [[../controlflow#lambda-expressions|4.7.6. Lambda 表达式]]
*** [[../controlflow#documentation-strings|4.7.7. Documentation Strings]]
+
*** [[../controlflow#documentation-strings|4.7.7. 文档字符串]]
*** [[../controlflow#function-annotations|4.7.8. Function Annotations]]
+
*** [[../controlflow#function-annotations|4.7.8. 函数注解]]
** [[controlflow.html#intermezzo-coding-style|4.8. Intermezzo: Coding Style]]
+
** [[../controlflow#intermezzo-coding-style|4.8. 间奏曲:编码风格]]
* [[../datastructures|5. Data Structures]]
+
* [[../datastructures|5. 数据结构]]
** [[../datastructures#more-on-lists|5.1. More on Lists]]
+
** [[../datastructures#more-on-lists|5.1. 更多关于列表]]
*** [[../datastructures#using-lists-as-stacks|5.1.1. Using Lists as Stacks]]
+
*** [[../datastructures#using-lists-as-stacks|5.1.1. 使用列表作为堆栈]]
*** [[../datastructures#using-lists-as-queues|5.1.2. Using Lists as Queues]]
+
*** [[../datastructures#using-lists-as-queues|5.1.2. 使用列表作为队列]]
*** [[../datastructures#list-comprehensions|5.1.3. List Comprehensions]]
+
*** [[../datastructures#list-comprehensions|5.1.3. 列表推导式]]
*** [[../datastructures#nested-list-comprehensions|5.1.4. Nested List Comprehensions]]
+
*** [[../datastructures#nested-list-comprehensions|5.1.4. 嵌套列表理解]]
** [[../datastructures#the-del-statement|5.2. The <code>del</code> statement]]
+
** [[../datastructures#the-del-statement|5.2. <code>del</code> 语句]]
** [[../datastructures#tuples-and-sequences|5.3. Tuples and Sequences]]
+
** [[../datastructures#tuples-and-sequences|5.3. 元组和序列]]
** [[../datastructures#sets|5.4. Sets]]
+
** [[../datastructures#sets|5.4. ]]
** [[../datastructures#dictionaries|5.5. Dictionaries]]
+
** [[../datastructures#dictionaries|5.5. 字典]]
** [[../datastructures#looping-techniques|5.6. Looping Techniques]]
+
** [[../datastructures#looping-techniques|5.6. 循环技术]]
** [[../datastructures#more-on-conditions|5.7. More on Conditions]]
+
** [[../datastructures#more-on-conditions|5.7. 更多关于条件]]
** [[../datastructures#comparing-sequences-and-other-types|5.8. Comparing Sequences and Other Types]]
+
** [[../datastructures#comparing-sequences-and-other-types|5.8. 比较序列和其他类型]]
* [[../modules|6. Modules]]
+
* [[../modules|6. 模块]]
** [[../modules#more-on-modules|6.1. More on Modules]]
+
** [[../modules#more-on-modules|6.1. 更多关于模块]]
*** [[../modules#executing-modules-as-scripts|6.1.1. Executing modules as scripts]]
+
*** [[../modules#executing-modules-as-scripts|6.1.1. 将模块作为脚本执行]]
*** [[../modules#the-module-search-path|6.1.2. The Module Search Path]]
+
*** [[../modules#the-module-search-path|6.1.2. 模块搜索路径]]
*** [[../modules#compiled-python-files|6.1.3. &quot;Compiled&quot; Python files]]
+
*** [[../modules#compiled-python-files|6.1.3. “已编译”的 Python 文件]]
** [[../modules#standard-modules|6.2. Standard Modules]]
+
** [[../modules#standard-modules|6.2. 标准模块]]
** [[../modules#the-dir-function|6.3. The <code>dir()</code> Function]]
+
** [[../modules#the-dir-function|6.3. <code>dir()</code> 功能]]
** [[../modules#packages|6.4. Packages]]
+
** [[../modules#packages|6.4. 套餐]]
*** [[../modules#importing-from-a-package|6.4.1. Importing * From a Package]]
+
*** [[../modules#importing-from-a-package|6.4.1. 从包中导入 *]]
*** [[../modules#intra-package-references|6.4.2. Intra-package References]]
+
*** [[../modules#intra-package-references|6.4.2. 包内引用]]
*** [[../modules#packages-in-multiple-directories|6.4.3. Packages in Multiple Directories]]
+
*** [[../modules#packages-in-multiple-directories|6.4.3. 多个目录中的包]]
* [[../inputoutput|7. Input and Output]]
+
* [[../inputoutput|7. 输入和输出]]
** [[../inputoutput#fancier-output-formatting|7.1. Fancier Output Formatting]]
+
** [[../inputoutput#fancier-output-formatting|7.1. 更高级的输出格式]]
*** [[../inputoutput#formatted-string-literals|7.1.1. Formatted String Literals]]
+
*** [[../inputoutput#formatted-string-literals|7.1.1. 格式化字符串文字]]
*** [[../inputoutput#the-string-format-method|7.1.2. The String format() Method]]
+
*** [[../inputoutput#the-string-format-method|7.1.2. String format() 方法]]
*** [[../inputoutput#manual-string-formatting|7.1.3. Manual String Formatting]]
+
*** [[../inputoutput#manual-string-formatting|7.1.3. 手动字符串格式化]]
*** [[../inputoutput#old-string-formatting|7.1.4. Old string formatting]]
+
*** [[../inputoutput#old-string-formatting|7.1.4. 旧的字符串格式]]
** [[../inputoutput#reading-and-writing-files|7.2. Reading and Writing Files]]
+
** [[../inputoutput#reading-and-writing-files|7.2. 读写文件]]
*** [[../inputoutput#methods-of-file-objects|7.2.1. Methods of File Objects]]
+
*** [[../inputoutput#methods-of-file-objects|7.2.1. 文件对象的方法]]
*** [[../inputoutput#saving-structured-data-with-json|7.2.2. Saving structured data with <code>json</code>]]
+
*** [[../inputoutput#saving-structured-data-with-json|7.2.2. 使用 <code>json</code> 保存结构化数据]]
* [[../errors|8. Errors and Exceptions]]
+
* [[../errors|8. 错误和异常]]
** [[../errors#syntax-errors|8.1. Syntax Errors]]
+
** [[../errors#syntax-errors|8.1. 语法错误]]
** [[../errors#exceptions|8.2. Exceptions]]
+
** [[../errors#exceptions|8.2. 例外]]
** [[../errors#handling-exceptions|8.3. Handling Exceptions]]
+
** [[../errors#handling-exceptions|8.3. 处理异常]]
** [[../errors#raising-exceptions|8.4. Raising Exceptions]]
+
** [[../errors#raising-exceptions|8.4. 引发异常]]
** [[../errors#exception-chaining|8.5. Exception Chaining]]
+
** [[../errors#exception-chaining|8.5. 异常链]]
** [[../errors#user-defined-exceptions|8.6. User-defined Exceptions]]
+
** [[../errors#user-defined-exceptions|8.6. 用户定义的异常]]
** [[../errors#defining-clean-up-actions|8.7. Defining Clean-up Actions]]
+
** [[../errors#defining-clean-up-actions|8.7. 定义清理操作]]
** [[../errors#predefined-clean-up-actions|8.8. Predefined Clean-up Actions]]
+
** [[../errors#predefined-clean-up-actions|8.8. 预定义的清理操作]]
* [[../classes|9. Classes]]
+
* [[../classes|9. 班级]]
** [[../classes#a-word-about-names-and-objects|9.1. A Word About Names and Objects]]
+
** [[../classes#a-word-about-names-and-objects|9.1. 关于名称和对象的一句话]]
** [[../classes#python-scopes-and-namespaces|9.2. Python Scopes and Namespaces]]
+
** [[../classes#python-scopes-and-namespaces|9.2. Python 范围和命名空间]]
*** [[../classes#scopes-and-namespaces-example|9.2.1. Scopes and Namespaces Example]]
+
*** [[../classes#scopes-and-namespaces-example|9.2.1. 范围和命名空间示例]]
** [[../classes#a-first-look-at-classes|9.3. A First Look at Classes]]
+
** [[../classes#a-first-look-at-classes|9.3. 类的第一眼]]
*** [[../classes#class-definition-syntax|9.3.1. Class Definition Syntax]]
+
*** [[../classes#class-definition-syntax|9.3.1. 类定义语法]]
*** [[../classes#class-objects|9.3.2. Class Objects]]
+
*** [[../classes#class-objects|9.3.2. 类对象]]
*** [[../classes#instance-objects|9.3.3. Instance Objects]]
+
*** [[../classes#instance-objects|9.3.3. 实例对象]]
*** [[../classes#method-objects|9.3.4. Method Objects]]
+
*** [[../classes#method-objects|9.3.4. 方法对象]]
*** [[../classes#class-and-instance-variables|9.3.5. Class and Instance Variables]]
+
*** [[../classes#class-and-instance-variables|9.3.5. 类和实例变量]]
** [[../classes#random-remarks|9.4. Random Remarks]]
+
** [[../classes#random-remarks|9.4. 随机备注]]
** [[../classes#inheritance|9.5. Inheritance]]
+
** [[../classes#inheritance|9.5. 遗产]]
*** [[../classes#multiple-inheritance|9.5.1. Multiple Inheritance]]
+
*** [[../classes#multiple-inheritance|9.5.1. 多重继承]]
** [[../classes#private-variables|9.6. Private Variables]]
+
** [[../classes#private-variables|9.6. 私有变量]]
** [[../classes#odds-and-ends|9.7. Odds and Ends]]
+
** [[../classes#odds-and-ends|9.7. 什物]]
** [[../classes#iterators|9.8. Iterators]]
+
** [[../classes#iterators|9.8. 迭代器]]
** [[../classes#generators|9.9. Generators]]
+
** [[../classes#generators|9.9. 发电机]]
** [[../classes#generator-expressions|9.10. Generator Expressions]]
+
** [[../classes#generator-expressions|9.10. 生成器表达式]]
* [[../stdlib|10. Brief Tour of the Standard Library]]
+
* [[../stdlib|10. 标准库简介]]
** [[../stdlib#operating-system-interface|10.1. Operating System Interface]]
+
** [[../stdlib#operating-system-interface|10.1. 操作系统接口]]
** [[../stdlib#file-wildcards|10.2. File Wildcards]]
+
** [[../stdlib#file-wildcards|10.2. 文件通配符]]
** [[../stdlib#command-line-arguments|10.3. Command Line Arguments]]
+
** [[../stdlib#command-line-arguments|10.3. 命令行参数]]
** [[../stdlib#error-output-redirection-and-program-termination|10.4. Error Output Redirection and Program Termination]]
+
** [[../stdlib#error-output-redirection-and-program-termination|10.4. 错误输出重定向和程序终止]]
** [[../stdlib#string-pattern-matching|10.5. String Pattern Matching]]
+
** [[../stdlib#string-pattern-matching|10.5. 字符串模式匹配]]
** [[../stdlib#mathematics|10.6. Mathematics]]
+
** [[../stdlib#mathematics|10.6. 数学]]
** [[../stdlib#internet-access|10.7. Internet Access]]
+
** [[../stdlib#internet-access|10.7. 互联网]]
** [[../stdlib#dates-and-times|10.8. Dates and Times]]
+
** [[../stdlib#dates-and-times|10.8. 日期和时间]]
** [[../stdlib#data-compression|10.9. Data Compression]]
+
** [[../stdlib#data-compression|10.9. 数据压缩]]
** [[../stdlib#performance-measurement|10.10. Performance Measurement]]
+
** [[../stdlib#performance-measurement|10.10. 绩效衡量]]
** [[../stdlib#quality-control|10.11. Quality Control]]
+
** [[../stdlib#quality-control|10.11. 质量控制]]
** [[../stdlib#batteries-included|10.12. Batteries Included]]
+
** [[../stdlib#batteries-included|10.12. 包括电池]]
* [[../stdlib2|11. Brief Tour of the Standard Library --- Part II]]
+
* [[../stdlib2|11. 标准库简介——第二部分]]
** [[../stdlib2#output-formatting|11.1. Output Formatting]]
+
** [[../stdlib2#output-formatting|11.1. 输出格式]]
** [[../stdlib2#templating|11.2. Templating]]
+
** [[../stdlib2#templating|11.2. 模板制作]]
** [[../stdlib2#working-with-binary-data-record-layouts|11.3. Working with Binary Data Record Layouts]]
+
** [[../stdlib2#working-with-binary-data-record-layouts|11.3. 使用二进制数据记录布局]]
** [[../stdlib2#multi-threading|11.4. Multi-threading]]
+
** [[../stdlib2#multi-threading|11.4. 多线程]]
** [[../stdlib2#logging|11.5. Logging]]
+
** [[../stdlib2#logging|11.5. 日志记录]]
** [[../stdlib2#weak-references|11.6. Weak References]]
+
** [[../stdlib2#weak-references|11.6. 弱引用]]
** [[../stdlib2#tools-for-working-with-lists|11.7. Tools for Working with Lists]]
+
** [[../stdlib2#tools-for-working-with-lists|11.7. 处理列表的工具]]
** [[../stdlib2#decimal-floating-point-arithmetic|11.8. Decimal Floating Point Arithmetic]]
+
** [[../stdlib2#decimal-floating-point-arithmetic|11.8. 十进制浮点运算]]
* [[../venv|12. Virtual Environments and Packages]]
+
* [[../venv|12. 虚拟环境和包]]
** [[../venv#introduction|12.1. Introduction]]
+
** [[../venv#introduction|12.1. 介绍]]
** [[../venv#creating-virtual-environments|12.2. Creating Virtual Environments]]
+
** [[../venv#creating-virtual-environments|12.2. 创建虚拟环境]]
** [[../venv#managing-packages-with-pip|12.3. Managing Packages with pip]]
+
** [[../venv#managing-packages-with-pip|12.3. 使用 pip 管理包]]
* [[../whatnow|13. What Now?]]
+
* [[../whatnow|13. 现在怎么办?]]
* [[../interactive|14. Interactive Input Editing and History Substitution]]
+
* [[../interactive|14. 交互式输入编辑和历史替换]]
** [[../interactive#tab-completion-and-history-editing|14.1. Tab Completion and History Editing]]
+
** [[../interactive#tab-completion-and-history-editing|14.1. 标签完成和历史编辑]]
** [[../interactive#alternatives-to-the-interactive-interpreter|14.2. Alternatives to the Interactive Interpreter]]
+
** [[../interactive#alternatives-to-the-interactive-interpreter|14.2. 交互式解释器的替代品]]
* [[floatingpoint.html|15. Floating Point Arithmetic: Issues and Limitations]]
+
* [[../floatingpoint|15. 浮点运算:问题和限制]]
** [[../floatingpoint#representation-error|15.1. Representation Error]]
+
** [[../floatingpoint#representation-error|15.1. 表示错误]]
* [[../appendix|16. Appendix]]
+
* [[../appendix|16. 附录]]
** [[../appendix#interactive-mode|16.1. Interactive Mode]]
+
** [[../appendix#interactive-mode|16.1. 交互模式]]
*** [[../appendix#error-handling|16.1.1. Error Handling]]
+
*** [[../appendix#error-handling|16.1.1. 错误处理]]
*** [[../appendix#executable-python-scripts|16.1.2. Executable Python Scripts]]
+
*** [[../appendix#executable-python-scripts|16.1.2. 可执行的 Python 脚本]]
*** [[../appendix#the-interactive-startup-file|16.1.3. The Interactive Startup File]]
+
*** [[../appendix#the-interactive-startup-file|16.1.3. 交互式启动文件]]
*** [[../appendix#the-customization-modules|16.1.4. The Customization Modules]]
+
*** [[../appendix#the-customization-modules|16.1.4. 自定义模块]]
  
  
第179行: 第159行:
  
 
</div>
 
</div>
 +
<div class="clearer">
  
[[Category:Python 3.9 中文文档]]
+
 
 +
 
 +
</div>
 +
 
 +
[[Category:Python 3.9 文档]]

2021年10月31日 (日) 04:54的最新版本

Python 教程

Python 是一种易于学习、功能强大的编程语言。 它具有高效的高级数据结构和简单但有效的面向对象编程方法。 Python 优雅的语法和动态类型,加上它的解释性质,使其成为大多数平台上许多领域的脚本编写和快速应用程序开发的理想语言。

Python 解释器和广泛的标准库可以从 Python 网站 https://www.python.org/ 以源代码或二进制形式免费提供给所有主要平台,并且可以免费分发。 该站点还包含许多免费的第三方 Python 模块、程序和工具以及其他文档的分发和指针。

Python 解释器很容易使用 C 或 C++(或其他可从 C 调用的语言)实现的新函数和数据类型进行扩展。 Python 也适合作为可定制应用程序的扩展语言。

本教程非正式地向读者介绍了 Python 语言和系统的基本概念和特性。 有一个 Python 解释器有助于实践经验,但所有示例都是独立的,因此本教程也可以离线阅读。

有关标准对象和模块的说明,请参阅 Python 标准库Python 语言参考 给出了更正式的语言定义。 要使用 C 或 C++ 编写扩展,请阅读 Extending and Embedding the Python InterpreterPython/C API Reference Manual。 还有几本书深入介绍了 Python。

本教程并不试图全面覆盖每一个功能,甚至每个常用功能。 相反,它介绍了 Python 的许多最值得注意的特性,并且会让您对这门语言的风格和风格有一个很好的了解。 阅读后,您将能够读写 Python 模块和程序,并且您将准备好进一步了解 Python 标准库 中描述的各种 Python 库模块。

词汇表也值得一读。