💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](introduction.xhtml "1. 概述") | - [上一页](../using/mac.xhtml "4. 在苹果系统上使用 Python") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - $('.inline-search').show(0); | # Python 语言参考 本参考手册描述了 Python 的语法和“核心语义”。本参考是简洁的,但试图做到准确和完整。 非必要的内建对象类型和内建函数、模块的语义描述在 [Python 标准库](../library/index.xhtml#library-index) 中。有关该语言的非正式介绍,请参阅 [Python 教程](../tutorial/index.xhtml#tutorial-index) 。对 C 或 C++ 程序员,还有两个额外的手册: [扩展和嵌入 Python 解释器](../extending/index.xhtml#extending-index) 概述了如何编写一个 Python 扩展模块,[Python/C API 参考手册](../c-api/index.xhtml#c-api-index) 详细介绍了 C/C++ 中可用的接口。 - [1. 概述](introduction.xhtml) - [1.1. 其他实现](introduction.xhtml#alternate-implementations) - [1.2. 标注](introduction.xhtml#notation) - [2. 词法分析](lexical_analysis.xhtml) - [2.1. 行结构](lexical_analysis.xhtml#line-structure) - [2.2. 其他形符](lexical_analysis.xhtml#other-tokens) - [2.3. 标识符和关键字](lexical_analysis.xhtml#identifiers) - [2.4. 字面值](lexical_analysis.xhtml#literals) - [2.5. 运算符](lexical_analysis.xhtml#operators) - [2.6. 分隔符](lexical_analysis.xhtml#delimiters) - [3. 数据模型](datamodel.xhtml) - [3.1. 对象、值与类型](datamodel.xhtml#objects-values-and-types) - [3.2. 标准类型层级结构](datamodel.xhtml#the-standard-type-hierarchy) - [3.3. 特殊方法名称](datamodel.xhtml#special-method-names) - [3.4. 协程](datamodel.xhtml#coroutines) - [4. 执行模型](executionmodel.xhtml) - [4.1. 程序的结构](executionmodel.xhtml#structure-of-a-program) - [4.2. 命名与绑定](executionmodel.xhtml#naming-and-binding) - [4.3. 异常](executionmodel.xhtml#exceptions) - [5. 导入系统](import.xhtml) - [5.1. `importlib`](import.xhtml#importlib) - [5.2. 包](import.xhtml#packages) - [5.3. 搜索](import.xhtml#searching) - [5.4. 加载](import.xhtml#loading) - [5.5. 基于路径的查找器](import.xhtml#the-path-based-finder) - [5.6. 替换标准导入系统](import.xhtml#replacing-the-standard-import-system) - [5.7. Package Relative Imports](import.xhtml#package-relative-imports) - [5.8. 有关 \_\_main\_\_ 的特殊事项](import.xhtml#special-considerations-for-main) - [5.9. 开放问题项](import.xhtml#open-issues) - [5.10. 参考文献](import.xhtml#references) - [6. 表达式](expressions.xhtml) - [6.1. 算术转换](expressions.xhtml#arithmetic-conversions) - [6.2. 原子](expressions.xhtml#atoms) - [6.3. 原型](expressions.xhtml#primaries) - [6.4. await 表达式](expressions.xhtml#await-expression) - [6.5. 幂运算符](expressions.xhtml#the-power-operator) - [6.6. 一元算术和位运算](expressions.xhtml#unary-arithmetic-and-bitwise-operations) - [6.7. 二元算术运算符](expressions.xhtml#binary-arithmetic-operations) - [6.8. 移位运算](expressions.xhtml#shifting-operations) - [6.9. 二元位运算](expressions.xhtml#binary-bitwise-operations) - [6.10. 比较运算](expressions.xhtml#comparisons) - [6.11. 布尔运算](expressions.xhtml#boolean-operations) - [6.12. 条件表达式](expressions.xhtml#conditional-expressions) - [6.13. lambda 表达式](expressions.xhtml#lambda) - [6.14. 表达式列表](expressions.xhtml#expression-lists) - [6.15. 求值顺序](expressions.xhtml#evaluation-order) - [6.16. 运算符优先级](expressions.xhtml#operator-precedence) - [7. 简单语句](simple_stmts.xhtml) - [7.1. 表达式语句](simple_stmts.xhtml#expression-statements) - [7.2. 赋值语句](simple_stmts.xhtml#assignment-statements) - [7.3. `assert` 语句](simple_stmts.xhtml#the-assert-statement) - [7.4. `pass` 语句](simple_stmts.xhtml#the-pass-statement) - [7.5. `del` 语句](simple_stmts.xhtml#the-del-statement) - [7.6. `return` 语句](simple_stmts.xhtml#the-return-statement) - [7.7. `yield` 语句](simple_stmts.xhtml#the-yield-statement) - [7.8. `raise` 语句](simple_stmts.xhtml#the-raise-statement) - [7.9. `break` 语句](simple_stmts.xhtml#the-break-statement) - [7.10. `continue` 语句](simple_stmts.xhtml#the-continue-statement) - [7.11. `import` 语句](simple_stmts.xhtml#the-import-statement) - [7.12. `global` 语句](simple_stmts.xhtml#the-global-statement) - [7.13. `nonlocal` 语句](simple_stmts.xhtml#the-nonlocal-statement) - [8. 复合语句](compound_stmts.xhtml) - [8.1. `if` 语句](compound_stmts.xhtml#the-if-statement) - [8.2. `while` 语句](compound_stmts.xhtml#the-while-statement) - [8.3. `for` 语句](compound_stmts.xhtml#the-for-statement) - [8.4. `try` 语句](compound_stmts.xhtml#the-try-statement) - [8.5. `with` 语句](compound_stmts.xhtml#the-with-statement) - [8.6. 函数定义](compound_stmts.xhtml#function-definitions) - [8.7. 类定义](compound_stmts.xhtml#class-definitions) - [8.8. 协程](compound_stmts.xhtml#coroutines) - [9. 最高层级组件](toplevel_components.xhtml) - [9.1. 完整的 Python 程序](toplevel_components.xhtml#complete-python-programs) - [9.2. 文件输入](toplevel_components.xhtml#file-input) - [9.3. 交互式输入](toplevel_components.xhtml#interactive-input) - [9.4. 表达式输入](toplevel_components.xhtml#expression-input) - [10. 完整的语法规范](grammar.xhtml) ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](introduction.xhtml "1. 概述") | - [上一页](../using/mac.xhtml "4. 在苹果系统上使用 Python") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - $('.inline-search').show(0); | © [版权所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 软件基金会是一个非盈利组织。 [请捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [发现了问题](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 创建。