Python 文档目录¶
- What’s New in Python
- What’s New In Python 3.12
- What’s New In Python 3.11
- Summary – Release highlights
- New Features
- New Features Related to Type Hints
- Other Language Changes
- Other CPython Implementation Changes
- New Modules
- Improved Modules
- Optimizations
- Faster CPython
- CPython bytecode changes
- Deprecated
- Pending Removal in Python 3.12
- Removed
- Porting to Python 3.11
- Build Changes
- C API Changes
- What’s New In Python 3.10
- Summary – Release highlights
- New Features
- New Features Related to Type Hints
- Other Language Changes
- New Modules
- Improved Modules
- asyncio
- argparse
- array
- asynchat, asyncore, smtpd
- base64
- bdb
- bisect
- codecs
- collections.abc
- contextlib
- curses
- dataclasses
- distutils
- doctest
- encodings
- enum
- fileinput
- faulthandler
- gc
- glob
- hashlib
- hmac
- IDLE and idlelib
- importlib.metadata
- inspect
- itertools
- linecache
- os
- os.path
- pathlib
- platform
- pprint
- py_compile
- pyclbr
- shelve
- statistics
- site
- socket
- ssl
- sqlite3
- sys
- _thread
- threading
- traceback
- types
- typing
- unittest
- urllib.parse
- xml
- zipimport
- Optimizations
- Deprecated
- Removed
- Porting to Python 3.10
- CPython bytecode changes
- Build Changes
- C API Changes
- What’s New In Python 3.9
- What’s New In Python 3.8
- Summary – Release highlights
- New Features
- Assignment expressions
- Positional-only parameters
- Parallel filesystem cache for compiled bytecode files
- Debug build uses the same ABI as release build
- f-strings support
=
for self-documenting expressions and debugging - PEP 578: Python Runtime Audit Hooks
- PEP 587: Python Initialization Configuration
- PEP 590: Vectorcall: a fast calling protocol for CPython
- Pickle protocol 5 with out-of-band data buffers
- Other Language Changes
- New Modules
- Improved Modules
- ast
- asyncio
- builtins
- collections
- cProfile
- csv
- curses
- ctypes
- datetime
- functools
- gc
- gettext
- gzip
- IDLE and idlelib
- inspect
- io
- itertools
- json.tool
- logging
- math
- mmap
- multiprocessing
- os
- os.path
- pathlib
- pickle
- plistlib
- pprint
- py_compile
- shlex
- shutil
- socket
- ssl
- statistics
- sys
- tarfile
- threading
- tokenize
- tkinter
- time
- typing
- unicodedata
- unittest
- venv
- weakref
- xml
- xmlrpc
- Optimizations
- Build and C API Changes
- Deprecated
- API and Feature Removals
- Porting to Python 3.8
- Notable changes in Python 3.8.1
- Notable changes in Python 3.8.8
- Notable changes in Python 3.8.12
- What’s New In Python 3.7
- Summary – Release Highlights
- New Features
- PEP 563: Postponed Evaluation of Annotations
- PEP 538: Legacy C Locale Coercion
- PEP 540: Forced UTF-8 Runtime Mode
- PEP 553: Built-in
breakpoint()
- PEP 539: New C API for Thread-Local Storage
- PEP 562: Customization of Access to Module Attributes
- PEP 564: New Time Functions With Nanosecond Resolution
- PEP 565: Show DeprecationWarning in
__main__
- PEP 560: Core Support for
typing
module and Generic Types - PEP 552: Hash-based .pyc Files
- PEP 545: Python Documentation Translations
- Python Development Mode (-X dev)
- Other Language Changes
- New Modules
- Improved Modules
- argparse
- asyncio
- binascii
- calendar
- collections
- compileall
- concurrent.futures
- contextlib
- cProfile
- crypt
- datetime
- dbm
- decimal
- dis
- distutils
- enum
- functools
- gc
- hmac
- http.client
- http.server
- idlelib and IDLE
- importlib
- io
- ipaddress
- itertools
- locale
- logging
- math
- mimetypes
- msilib
- multiprocessing
- os
- pathlib
- pdb
- py_compile
- pydoc
- queue
- re
- signal
- socket
- socketserver
- sqlite3
- ssl
- string
- subprocess
- sys
- time
- tkinter
- tracemalloc
- types
- unicodedata
- unittest
- unittest.mock
- urllib.parse
- uu
- uuid
- warnings
- xml.etree
- xmlrpc.server
- zipapp
- zipfile
- C API Changes
- Build Changes
- Optimizations
- Other CPython Implementation Changes
- Deprecated Python Behavior
- Deprecated Python modules, functions and methods
- Deprecated functions and types of the C API
- Platform Support Removals
- API and Feature Removals
- Module Removals
- Windows-only Changes
- Porting to Python 3.7
- Notable changes in Python 3.7.1
- Notable changes in Python 3.7.2
- Notable changes in Python 3.7.6
- Notable changes in Python 3.7.10
- What’s New In Python 3.6
- Summary – Release highlights
- New Features
- PEP 498: Formatted string literals
- PEP 526: Syntax for variable annotations
- PEP 515: Underscores in Numeric Literals
- PEP 525: Asynchronous Generators
- PEP 530: Asynchronous Comprehensions
- PEP 487: Simpler customization of class creation
- PEP 487: Descriptor Protocol Enhancements
- PEP 519: Adding a file system path protocol
- PEP 495: Local Time Disambiguation
- PEP 529: Change Windows filesystem encoding to UTF-8
- PEP 528: Change Windows console encoding to UTF-8
- PEP 520: Preserving Class Attribute Definition Order
- PEP 468: Preserving Keyword Argument Order
- New dict implementation
- PEP 523: Adding a frame evaluation API to CPython
- PYTHONMALLOC environment variable
- DTrace and SystemTap probing support
- Other Language Changes
- New Modules
- Improved Modules
- array
- ast
- asyncio
- binascii
- cmath
- collections
- concurrent.futures
- contextlib
- datetime
- decimal
- distutils
- encodings
- enum
- faulthandler
- fileinput
- hashlib
- http.client
- idlelib and IDLE
- importlib
- inspect
- json
- logging
- math
- multiprocessing
- os
- pathlib
- pdb
- pickle
- pickletools
- pydoc
- random
- re
- readline
- rlcompleter
- shlex
- site
- sqlite3
- socket
- socketserver
- ssl
- statistics
- struct
- subprocess
- sys
- telnetlib
- time
- timeit
- tkinter
- traceback
- tracemalloc
- typing
- unicodedata
- unittest.mock
- urllib.request
- urllib.robotparser
- venv
- warnings
- winreg
- winsound
- xmlrpc.client
- zipfile
- zlib
- Optimizations
- Build and C API Changes
- Other Improvements
- Deprecated
- Removed
- Porting to Python 3.6
- Notable changes in Python 3.6.2
- Notable changes in Python 3.6.4
- Notable changes in Python 3.6.5
- Notable changes in Python 3.6.7
- Notable changes in Python 3.6.10
- Notable changes in Python 3.6.13
- What’s New In Python 3.5
- Summary – Release highlights
- New Features
- PEP 492 - Coroutines with async and await syntax
- PEP 465 - A dedicated infix operator for matrix multiplication
- PEP 448 - Additional Unpacking Generalizations
- PEP 461 - percent formatting support for bytes and bytearray
- PEP 484 - Type Hints
- PEP 471 - os.scandir() function – a better and faster directory iterator
- PEP 475: Retry system calls failing with EINTR
- PEP 479: Change StopIteration handling inside generators
- PEP 485: A function for testing approximate equality
- PEP 486: Make the Python Launcher aware of virtual environments
- PEP 488: Elimination of PYO files
- PEP 489: Multi-phase extension module initialization
- Other Language Changes
- New Modules
- Improved Modules
- argparse
- asyncio
- bz2
- cgi
- cmath
- code
- collections
- collections.abc
- compileall
- concurrent.futures
- configparser
- contextlib
- csv
- curses
- dbm
- difflib
- distutils
- doctest
- enum
- faulthandler
- functools
- glob
- gzip
- heapq
- http
- http.client
- idlelib and IDLE
- imaplib
- imghdr
- importlib
- inspect
- io
- ipaddress
- json
- linecache
- locale
- logging
- lzma
- math
- multiprocessing
- operator
- os
- pathlib
- pickle
- poplib
- re
- readline
- selectors
- shutil
- signal
- smtpd
- smtplib
- sndhdr
- socket
- ssl
- sqlite3
- subprocess
- sys
- sysconfig
- tarfile
- threading
- time
- timeit
- tkinter
- traceback
- types
- unicodedata
- unittest
- unittest.mock
- urllib
- wsgiref
- xmlrpc
- xml.sax
- zipfile
- Other module-level changes
- Optimizations
- Build and C API Changes
- Deprecated
- Removed
- Porting to Python 3.5
- Notable changes in Python 3.5.4
- What’s New In Python 3.4
- Summary – Release Highlights
- New Features
- New Modules
- Improved Modules
- abc
- aifc
- argparse
- audioop
- base64
- collections
- colorsys
- contextlib
- dbm
- dis
- doctest
- filecmp
- functools
- gc
- glob
- hashlib
- hmac
- html
- http
- idlelib and IDLE
- importlib
- inspect
- ipaddress
- logging
- marshal
- mmap
- multiprocessing
- operator
- os
- pdb
- pickle
- plistlib
- poplib
- pprint
- pty
- pydoc
- re
- resource
- select
- shelve
- shutil
- smtpd
- smtplib
- socket
- sqlite3
- ssl
- stat
- struct
- subprocess
- sunau
- sys
- tarfile
- textwrap
- threading
- traceback
- types
- urllib
- unittest
- venv
- wave
- weakref
- xml.etree
- zipfile
- CPython Implementation Changes
- Deprecated
- Removed
- Porting to Python 3.4
- Changed in 3.4.3
- What’s New In Python 3.3
- Summary – Release highlights
- PEP 405: Virtual Environments
- PEP 420: Implicit Namespace Packages
- PEP 3118: New memoryview implementation and buffer protocol documentation
- PEP 393: Flexible String Representation
- PEP 397: Python Launcher for Windows
- PEP 3151: Reworking the OS and IO exception hierarchy
- PEP 380: Syntax for Delegating to a Subgenerator
- PEP 409: Suppressing exception context
- PEP 414: Explicit Unicode literals
- PEP 3155: Qualified name for classes and functions
- PEP 412: Key-Sharing Dictionary
- PEP 362: Function Signature Object
- PEP 421: Adding sys.implementation
- Using importlib as the Implementation of Import
- Other Language Changes
- A Finer-Grained Import Lock
- Builtin functions and types
- New Modules
- Improved Modules
- abc
- array
- base64
- binascii
- bz2
- codecs
- collections
- contextlib
- crypt
- curses
- datetime
- decimal
- ftplib
- functools
- gc
- hmac
- http
- html
- imaplib
- inspect
- io
- itertools
- logging
- math
- mmap
- multiprocessing
- nntplib
- os
- pdb
- pickle
- pydoc
- re
- sched
- select
- shlex
- shutil
- signal
- smtpd
- smtplib
- socket
- socketserver
- sqlite3
- ssl
- stat
- struct
- subprocess
- sys
- tarfile
- tempfile
- textwrap
- threading
- time
- types
- unittest
- urllib
- webbrowser
- xml.etree.ElementTree
- zlib
- Optimizations
- Build and C API Changes
- Deprecated
- Porting to Python 3.3
- What’s New In Python 3.2
- PEP 384: Defining a Stable ABI
- PEP 389: Argparse Command Line Parsing Module
- PEP 391: Dictionary Based Configuration for Logging
- PEP 3148: The
concurrent.futures
module - PEP 3147: PYC Repository Directories
- PEP 3149: ABI Version Tagged .so Files
- PEP 3333: Python Web Server Gateway Interface v1.0.1
- Other Language Changes
- New, Improved, and Deprecated Modules
- elementtree
- functools
- itertools
- collections
- threading
- datetime and time
- math
- abc
- io
- reprlib
- logging
- csv
- contextlib
- decimal and fractions
- ftp
- popen
- select
- gzip and zipfile
- tarfile
- hashlib
- ast
- os
- shutil
- sqlite3
- html
- socket
- ssl
- nntp
- certificates
- imaplib
- http.client
- unittest
- random
- poplib
- asyncore
- tempfile
- inspect
- pydoc
- dis
- dbm
- ctypes
- site
- sysconfig
- pdb
- configparser
- urllib.parse
- mailbox
- turtledemo
- Multi-threading
- Optimizations
- Unicode
- Codecs
- Documentation
- IDLE
- Code Repository
- Build and C API Changes
- Porting to Python 3.2
- What’s New In Python 3.1
- What’s New In Python 3.0
- What’s New in Python 2.7
- The Future for Python 2.x
- Changes to the Handling of Deprecation Warnings
- Python 3.1 Features
- PEP 372: Adding an Ordered Dictionary to collections
- PEP 378: Format Specifier for Thousands Separator
- PEP 389: The argparse Module for Parsing Command Lines
- PEP 391: Dictionary-Based Configuration For Logging
- PEP 3106: Dictionary Views
- PEP 3137: The memoryview Object
- Other Language Changes
- New and Improved Modules
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.7
- New Features Added to Python 2.7 Maintenance Releases
- Two new environment variables for debug mode
- PEP 434: IDLE Enhancement Exception for All Branches
- PEP 466: Network Security Enhancements for Python 2.7
- PEP 477: Backport ensurepip (PEP 453) to Python 2.7
- PEP 476: Enabling certificate verification by default for stdlib http clients
- PEP 493: HTTPS verification migration tools for Python 2.7
- New
make regen-all
build target - Removal of
make touch
build target
- Acknowledgements
- What’s New in Python 2.6
- Python 3.0
- Changes to the Development Process
- PEP 343: The ‘with’ statement
- PEP 366: Explicit Relative Imports From a Main Module
- PEP 370: Per-user
site-packages
Directory - PEP 371: The
multiprocessing
Package - PEP 3101: Advanced String Formatting
- PEP 3105:
print
As a Function - PEP 3110: Exception-Handling Changes
- PEP 3112: Byte Literals
- PEP 3116: New I/O Library
- PEP 3118: Revised Buffer Protocol
- PEP 3119: Abstract Base Classes
- PEP 3127: Integer Literal Support and Syntax
- PEP 3129: Class Decorators
- PEP 3141: A Type Hierarchy for Numbers
- Other Language Changes
- New and Improved Modules
- Deprecations and Removals
- Build and C API Changes
- Porting to Python 2.6
- Acknowledgements
- What’s New in Python 2.5
- PEP 308: Conditional Expressions
- PEP 309: Partial Function Application
- PEP 314: Metadata for Python Software Packages v1.1
- PEP 328: Absolute and Relative Imports
- PEP 338: Executing Modules as Scripts
- PEP 341: Unified try/except/finally
- PEP 342: New Generator Features
- PEP 343: The ‘with’ statement
- PEP 352: Exceptions as New-Style Classes
- PEP 353: Using ssize_t as the index type
- PEP 357: The ‘__index__’ method
- Other Language Changes
- New, Improved, and Removed Modules
- Build and C API Changes
- Porting to Python 2.5
- Acknowledgements
- What’s New in Python 2.4
- PEP 218: Built-In Set Objects
- PEP 237: Unifying Long Integers and Integers
- PEP 289: Generator Expressions
- PEP 292: Simpler String Substitutions
- PEP 318: Decorators for Functions and Methods
- PEP 322: Reverse Iteration
- PEP 324: New subprocess Module
- PEP 327: Decimal Data Type
- PEP 328: Multi-line Imports
- PEP 331: Locale-Independent Float/String Conversions
- Other Language Changes
- New, Improved, and Deprecated Modules
- Build and C API Changes
- Porting to Python 2.4
- Acknowledgements
- What’s New in Python 2.3
- PEP 218: A Standard Set Datatype
- PEP 255: Simple Generators
- PEP 263: Source Code Encodings
- PEP 273: Importing Modules from ZIP Archives
- PEP 277: Unicode file name support for Windows NT
- PEP 278: Universal Newline Support
- PEP 279: enumerate()
- PEP 282: The logging Package
- PEP 285: A Boolean Type
- PEP 293: Codec Error Handling Callbacks
- PEP 301: Package Index and Metadata for Distutils
- PEP 302: New Import Hooks
- PEP 305: Comma-separated Files
- PEP 307: Pickle Enhancements
- Extended Slices
- Other Language Changes
- New, Improved, and Deprecated Modules
- Pymalloc: A Specialized Object Allocator
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.3
- Acknowledgements
- What’s New in Python 2.2
- Introduction
- PEPs 252 and 253: Type and Class Changes
- PEP 234: Iterators
- PEP 255: Simple Generators
- PEP 237: Unifying Long Integers and Integers
- PEP 238: Changing the Division Operator
- Unicode Changes
- PEP 227: Nested Scopes
- New and Improved Modules
- Interpreter Changes and Fixes
- Other Changes and Fixes
- Acknowledgements
- What’s New in Python 2.1
- Introduction
- PEP 227: Nested Scopes
- PEP 236: __future__ Directives
- PEP 207: Rich Comparisons
- PEP 230: Warning Framework
- PEP 229: New Build System
- PEP 205: Weak References
- PEP 232: Function Attributes
- PEP 235: Importing Modules on Case-Insensitive Platforms
- PEP 217: Interactive Display Hook
- PEP 208: New Coercion Model
- PEP 241: Metadata in Python Packages
- New and Improved Modules
- Other Changes and Fixes
- Acknowledgements
- What’s New in Python 2.0
- Introduction
- What About Python 1.6?
- New Development Process
- Unicode
- List Comprehensions
- Augmented Assignment
- String Methods
- Garbage Collection of Cycles
- Other Core Changes
- Porting to 2.0
- Extending/Embedding Changes
- Distutils: Making Modules Easy to Install
- XML Modules
- Module changes
- New modules
- IDLE Improvements
- Deleted and Deprecated Modules
- Acknowledgements
- Changelog
- Python next
- Python 3.11.0 beta 1
- Python 3.11.0 alpha 7
- Python 3.11.0 alpha 6
- Python 3.11.0 alpha 5
- Python 3.11.0 alpha 4
- Python 3.11.0 alpha 3
- Python 3.11.0 alpha 2
- Python 3.11.0 alpha 1
- Python 3.10.0 beta 1
- Python 3.10.0 alpha 7
- Python 3.10.0 alpha 6
- Python 3.10.0 alpha 5
- Python 3.10.0 alpha 4
- Python 3.10.0 alpha 3
- Python 3.10.0 alpha 2
- Python 3.10.0 alpha 1
- Python 3.9.0 beta 1
- Python 3.9.0 alpha 6
- Python 3.9.0 alpha 5
- Python 3.9.0 alpha 4
- Python 3.9.0 alpha 3
- Python 3.9.0 alpha 2
- Python 3.9.0 alpha 1
- Python 3.8.0 beta 1
- Python 3.8.0 alpha 4
- Python 3.8.0 alpha 3
- Python 3.8.0 alpha 2
- Python 3.8.0 alpha 1
- Python 3.7.0 final
- Python 3.7.0 release candidate 1
- Python 3.7.0 beta 5
- Python 3.7.0 beta 4
- Python 3.7.0 beta 3
- Python 3.7.0 beta 2
- Python 3.7.0 beta 1
- Python 3.7.0 alpha 4
- Python 3.7.0 alpha 3
- Python 3.7.0 alpha 2
- Python 3.7.0 alpha 1
- Python 3.6.6 final
- Python 3.6.6 release candidate 1
- Python 3.6.5 final
- Python 3.6.5 release candidate 1
- Python 3.6.4 final
- Python 3.6.4 release candidate 1
- Python 3.6.3 final
- Python 3.6.3 release candidate 1
- Python 3.6.2 final
- Python 3.6.2 release candidate 2
- Python 3.6.2 release candidate 1
- Python 3.6.1 final
- Python 3.6.1 release candidate 1
- Python 3.6.0 final
- Python 3.6.0 release candidate 2
- Python 3.6.0 release candidate 1
- Python 3.6.0 beta 4
- Python 3.6.0 beta 3
- Python 3.6.0 beta 2
- Python 3.6.0 beta 1
- Python 3.6.0 alpha 4
- Python 3.6.0 alpha 3
- Python 3.6.0 alpha 2
- Python 3.6.0 alpha 1
- Python 3.5.5 final
- Python 3.5.5 release candidate 1
- Python 3.5.4 final
- Python 3.5.4 release candidate 1
- Python 3.5.3 final
- Python 3.5.3 release candidate 1
- Python 3.5.2 final
- Python 3.5.2 release candidate 1
- Python 3.5.1 final
- Python 3.5.1 release candidate 1
- Python 3.5.0 final
- Python 3.5.0 release candidate 4
- Python 3.5.0 release candidate 3
- Python 3.5.0 release candidate 2
- Python 3.5.0 release candidate 1
- Python 3.5.0 beta 4
- Python 3.5.0 beta 3
- Python 3.5.0 beta 2
- Python 3.5.0 beta 1
- Python 3.5.0 alpha 4
- Python 3.5.0 alpha 3
- Python 3.5.0 alpha 2
- Python 3.5.0 alpha 1
- Python 教程
- 1. 课前甜点
- 2. Python 解释器
- 3. Python 速览
- 4. 其他流程控制工具
- 5. 数据结构
- 6. 模块
- 7. 输入与输出
- 8. 错误和异常
- 9. 类
- 10. 标准库简介
- 11. 标准库简介 —— 第二部分
- 12. 虚拟环境和包
- 13. 接下来?
- 14. 交互式编辑和编辑历史
- 15. 浮点算术:争议和限制
- 16. 附录
- Python安装和使用
- 1. 命令行与环境
- 2. 在类Unix环境下使用Python
- 3. 配置 Python
- 4. 在Windows上使用 Python
- 5. Using Python on a Mac
- 6. 编辑器和集成开发环境
- Python 语言参考手册
- 1. 概述
- 2. 词法分析
- 3. 数据模型
- 4. 执行模型
- 5. 导入系统
- 6. 表达式
- 7. 简单语句
- 8. 复合语句
- 9. 顶级组件
- 10. 完整的语法规范
- Python 标准库
- 概述
- 内置函数
- 内置常量
- 内置类型
- 内置异常
- 文本处理服务
- 二进制数据服务
- 数据类型
datetime
— 基本日期和时间类型zoneinfo
— IANA 时区支持calendar
— 日历相关函数collections
— 容器数据类型collections.abc
— 容器的抽象基类heapq
— 堆队列算法bisect
— 数组二分查找算法array
— 高效的数值数组weakref
— 弱引用types
— 动态类型创建和内置类型名称copy
— 浅层 (shallow) 和深层 (deep) 复制操作pprint
— 数据美化输出reprlib
— 另一种repr()
实现enum
— 对枚举的支持graphlib
— 操作类似图的结构的功能
- 数字和数学模块
- 函数式编程模块
- 文件和目录访问
- 数据持久化
pickle
— Python 对象序列化copyreg
— 注册配合pickle
模块使用的函数shelve
— Python 对象持久化marshal
— 内部 Python 对象序列化dbm
— Unix “数据库” 接口sqlite3
— SQLite 数据库 DB-API 2.0 接口模块- Tutorial
- Reference
- How-to guides
- Explanation
- 数据压缩和存档
- 文件格式
- 加密服务
- 通用操作系统服务
os
— 多种操作系统接口io
— 处理流的核心工具time
— 时间的访问和转换argparse
— 命令行选项、参数和子命令解析器getopt
— C 风格的命令行选项解析器logging
— Python 的日志记录工具logging.config
— 日志记录配置logging.handlers
— 日志处理程序getpass
— 便携式密码输入工具curses
— 终端字符单元显示的处理curses.textpad
— 用于 curses 程序的文本输入控件curses.ascii
— 用于 ASCII 字符的工具curses.panel
— curses 的面板栈扩展platform
— 获取底层平台的标识数据errno
— 标准 errno 系统符号ctypes
— Python 的外部函数库
- 并发执行
threading
— 基于线程的并行multiprocessing
— 基于进程的并行multiprocessing.shared_memory
— Shared memory for direct access across processesconcurrent
包concurrent.futures
— 启动并行任务subprocess
— 子进程管理sched
— 事件调度器queue
— 一个同步的队列类contextvars
— 上下文变量_thread
— 底层多线程 API
- 网络和进程间通信
- 互联网数据处理
email
— 电子邮件与 MIME 处理包email.message
: 表示一封电子邮件信息email.parser
: 解析电子邮件信息email.generator
: 生成 MIME 文档email.policy
: Policy 对象email.errors
: 异常和缺陷类email.headerregistry
: 自定义标头对象email.contentmanager
: 管理 MIME 内容email
: 示例email.message.Message
: 使用compat32
API 来表示电子邮件消息email.mime
: 从头创建电子邮件和 MIME 对象email.header
: 国际化标头email.charset
: 表示字符集email.encoders
: 编码器email.utils
: 其他工具email.iterators
: 迭代器
json
— JSON 编码和解码器mailbox
— 操作多种格式的邮箱mimetypes
— 映射文件名到 MIME 类型base64
— Base16, Base32, Base64, Base85 数据编码binascii
— 二进制和 ASCII 码互转quopri
— 编码与解码经过 MIME 转码的可打印数据
- 结构化标记处理工具
html
— 超文本标记语言支持html.parser
— 简单的 HTML 和 XHTML 解析器html.entities
— HTML 一般实体的定义- XML处理模块
xml.etree.ElementTree
— ElementTree XML APIxml.dom
— 文档对象模型 APIxml.dom.minidom
— 最小化的 DOM 实现xml.dom.pulldom
— 支持构建部分 DOM 树xml.sax
— 支持 SAX2 解析器xml.sax.handler
— SAX 处理句柄的基类xml.sax.saxutils
— SAX 工具集xml.sax.xmlreader
— 用于 XML 解析器的接口xml.parsers.expat
— 使用 Expat 的快速 XML 解析
- 互联网协议和支持
webbrowser
— 方便的 Web 浏览器控制工具wsgiref
— WSGI 工具和参考实现urllib
— URL 处理模块urllib.request
— 用于打开 URL 的可扩展库- Request 对象
- OpenerDirector 对象
- BaseHandler 对象
- HTTPRedirectHandler 对象
- HTTPCookieProcessor 对象
- ProxyHandler 对象
- HTTPPasswordMgr 对象
- HTTPPasswordMgrWithPriorAuth 对象
- AbstractBasicAuthHandler 对象
- HTTPBasicAuthHandler 对象
- ProxyBasicAuthHandler 对象
- AbstractDigestAuthHandler 对象
- HTTPDigestAuthHandler 对象
- ProxyDigestAuthHandler 对象
- HTTPHandler 对象
- HTTPSHandler 对象
- FileHandler 对象
- DataHandler 对象
- FTPHandler 对象
- CacheFTPHandler 对象
- UnknownHandler 对象
- HTTPErrorProcessor 对象
- 例子
- 已停用的接口
urllib.request
的限制
urllib.response
— urllib 使用的 Response 类urllib.parse
用于解析 URLurllib.error
— urllib.request 引发的异常类urllib.robotparser
— robots.txt 语法分析程序http
— HTTP 模块http.client
— HTTP 协议客户端ftplib
— FTP 协议客户端poplib
— POP3 协议客户端imaplib
— IMAP4 协议客户端smtplib
—SMTP协议客户端uuid
— RFC 4122 定义的UUID对象socketserver
— A framework for network servershttp.server
— HTTP 服务器http.cookies
— HTTP状态管理http.cookiejar
—— HTTP 客户端的 Cookie 处理xmlrpc
— XMLRPC 服务端与客户端模块xmlrpc.client
— XML-RPC 客户端访问xmlrpc.server
— 基本 XML-RPC 服务器ipaddress
— IPv4/IPv6 操作库
- 多媒体服务
- 国际化
- 程序框架
- Tk图形用户界面(GUI)
tkinter
— Tcl/Tk的Python接口tkinter.colorchooser
— 颜色选择对话框tkinter.font
— Tkinter 字体封装- Tkinter 对话框
tkinter.messagebox
— Tkinter 消息提示tkinter.scrolledtext
— 滚动文字控件tkinter.dnd
— 拖放操作支持tkinter.ttk
— Tk主题部件tkinter.tix
— TK扩展包- IDLE
- 开发工具
typing
— 类型提示支持pydoc
— 文档生成器和在线帮助系统- Python 开发模式
- Effects of the Python Development Mode
- ResourceWarning Example
- Bad file descriptor error example
doctest
— 测试交互性的Python示例unittest
— 单元测试框架unittest.mock
— 模拟对象库unittest.mock
上手指南- 使用 mock
- Patch Decorators
- Further Examples
- Mocking chained calls
- Partial mocking
- Mocking a Generator Method
- Applying the same patch to every test method
- Mocking Unbound Methods
- Checking multiple calls with mock
- Coping with mutable arguments
- Nesting Patches
- Mocking a dictionary with MagicMock
- Mock subclasses and their attributes
- Mocking imports with patch.dict
- Tracking order of calls and less verbose call assertions
- More complex argument matching
- 2to3 — Automated Python 2 to 3 code translation
test
— Python回归测试包test.support
— Utilities for the Python test suitetest.support.socket_helper
— Utilities for socket teststest.support.script_helper
— Utilities for the Python execution teststest.support.bytecode_helper
— Support tools for testing correct bytecode generationtest.support.threading_helper
— Utilities for threading teststest.support.os_helper
— Utilities for os teststest.support.import_helper
— Utilities for import teststest.support.warnings_helper
— Utilities for warnings tests
- 调试和分析
- 软件打包和分发
- Python运行时服务
sys
— 系统相关的参数和函数sysconfig
— Provide access to Python’s configuration informationbuiltins
— 内建对象__main__
— Top-level code environmentwarnings
—— 警告信息的控制dataclasses
— 数据类contextlib
— 为with
语句上下文提供的工具abc
— 抽象基类atexit
— 退出处理器traceback
— 打印或检索堆栈回溯__future__
— Future 语句定义gc
— 垃圾回收器接口inspect
— 检查对象site
—— 指定域的配置钩子
- 自定义 Python 解释器
- 导入模块
zipimport
— 从 Zip 存档中导入模块pkgutil
— 包扩展工具modulefinder
— 查找脚本使用的模块runpy
——查找并执行 Python 模块importlib
—import
的实现importlib.resources
– Resources- Deprecated functions
importlib.resources.abc
– Abstract base classes for resources- 使用
importlib.metadata
- The initialization of the
sys.path
module search path
- Python 语言服务
- Windows系统相关模块
- Unix 专有服务
- 被取代的模块
aifc
— 读写 AIFF 和 AIFC 文件asynchat
— 异步套接字指令/响应处理程序asyncore
— 异步套接字处理器audioop
— 处理原始音频数据cgi
— 通用网关接口支持cgitb
— 用于 CGI 脚本的回溯管理器chunk
— 读取 IFF 分块数据crypt
—— 验证 Unix 口令的函数imghdr
— 推测图像类型imp
—— 由代码内部访问 import 。mailcap
— Mailcap 文件处理msilib
— Read and write Microsoft Installer filesnis
— Sun 的 NIS (黄页) 接口nntplib
— NNTP 协议客户端optparse
— 解析器的命令行选项- 背景
- 教程
- 参考指南
- Option Callbacks
- Defining a callback option
- How callbacks are called
- Raising errors in a callback
- Callback example 1: trivial callback
- Callback example 2: check option order
- Callback example 3: check option order (generalized)
- Callback example 4: check arbitrary condition
- Callback example 5: fixed arguments
- Callback example 6: variable arguments
- Extending
optparse
ossaudiodev
— 访问兼容OSS的音频设备pipes
— 终端管道接口sndhdr
— 推测声音文件的类型spwd
—— shadow 密码库sunau
— 读写 Sun AU 文件telnetlib
– Telnet 客户端uu
— 对 uuencode 文件进行编码与解码xdrlib
— 编码与解码 XDR 数据
- Security Considerations
- 扩展和嵌入 Python 解释器
- Python/C API 参考手册
- 概述
- C API Stability
- The Very High Level Layer
- 引用计数
- 异常处理
- 工具
- 抽象对象层
- 具体的对象层
- 初始化,终结和线程
- Python初始化配置
- 内存管理
- 对象实现支持
- API 和 ABI 版本管理
- 分发 Python 模块
- 安装 Python 模块
- Python 常用指引
- 将 Python 2 代码迁移到 Python 3
- 将扩展模块移植到 Python 3
- 用 Python 进行 Curses 编程
- 描述器使用指南
- Enum HOWTO
- Programmatic access to enumeration members and their attributes
- Duplicating enum members and values
- Ensuring unique enumeration values
- Using automatic values
- Iteration
- Comparisons
- Allowed members and attributes of enumerations
- Restricted Enum subclassing
- Pickling
- Functional API
- Derived Enumerations
- When to use
__new__()
vs.__init__()
- How are Enums different?
- Subclassing EnumType
- 函数式编程指引
- 日志常用指引
- 日志操作手册
- 在多个模块中记录日志
- 在多个线程中记录日志
- 多个 handler 和多种 formatter
- 在多个地方记录日志
- 日志配置服务器示例
- 处理日志 handler 的阻塞
- 通过网络收发日志事件
- 在自己的输出日志中添加上下文信息
- Use of
contextvars
- Imparting contextual information in handlers
- 从多个进程记录至单个文件
- 轮换日志文件
- 使用其他日志格式化方式
- 自定义
LogRecord
- 子类化 QueueHandler - ZeroMQ 示例
- 子类化 QueueListener —— ZeroMQ 示例
- 基于字典进行日志配置的示例
- 利用 rotator 和 namer 自定义日志轮换操作
- 更加详细的多道处理示例
- 在发送给 SysLogHandler 的信息中插入一个 BOM。
- 结构化日志的实现代码
- 利用
dictConfig()
自定义 handler - 生效于整个应用程序的格式化样式
- 利用
dictConfig()
定义过滤器 - 异常信息的自定义格式化
- 语音播报日志信息
- 缓冲日志消息并有条件地输出它们
- Sending logging messages to email, with buffering
- 通过配置使用UTC (GMT) 格式化时间
- 使用上下文管理器的可选的日志记录
- 命令行日志应用起步
- Qt GUI 日志示例
- Logging to syslog with RFC5424 support
- How to treat a logger like an output stream
- 理应避免的用法
- Other resources
- 正则表达式HOWTO
- 套接字编程指南
- 排序指南
- Unicode 指南
- 如何利用 urllib 包获取网络资源
- Argparse 教程
- ipaddress模块介绍
- Argument Clinic How-To
- The Goals Of Argument Clinic
- Basic Concepts And Usage
- Converting Your First Function
- Advanced Topics
- Symbolic default values
- Renaming the C functions and variables generated by Argument Clinic
- Converting functions using PyArg_UnpackTuple
- Optional Groups
- Using real Argument Clinic converters, instead of “legacy converters”
- Py_buffer
- Advanced converters
- Parameter default values
- The
NULL
default value - Expressions specified as default values
- Using a return converter
- Cloning existing functions
- Calling Python code
- Using a “self converter”
- Using a “defining class” converter
- Writing a custom converter
- Writing a custom return converter
- METH_O and METH_NOARGS
- tp_new and tp_init functions
- Changing and redirecting Clinic’s output
- The #ifdef trick
- Using Argument Clinic in Python files
- 使用 DTrace 和 SystemTap 检测CPython
- Python 对 Linux 性能分析器
perf
的支持 - 对象注解属性的最佳实践
- Isolating Extension Modules
- Python 常见问题
- Python常见问题
- 编程常见问题
- 设计和历史常见问题
- 为什么Python使用缩进来分组语句?
- 为什么简单的算术运算得到奇怪的结果?
- 为什么浮点计算不准确?
- 为什么Python字符串是不可变的?
- 为什么必须在方法定义和调用中显式使用“self”?
- 为什么不能在表达式中赋值?
- 为什么Python对某些功能(例如list.index())使用方法来实现,而其他功能(例如len(List))使用函数实现?
- 为什么 join() 是一个字符串方法而不是列表或元组方法?
- 异常有多快?
- 为什么Python中没有switch或case语句?
- 难道不能在解释器中模拟线程,而非得依赖特定于操作系统的线程实现吗?
- 为什么lambda表达式不能包含语句?
- 可以将Python编译为机器代码,C或其他语言吗?
- Python如何管理内存?
- 为什么CPython不使用更传统的垃圾回收方案?
- CPython退出时为什么不释放所有内存?
- 为什么有单独的元组和列表数据类型?
- 列表是如何在CPython中实现的?
- 字典是如何在CPython中实现的?
- 为什么字典key必须是不可变的?
- 为什么 list.sort() 没有返回排序列表?
- 如何在Python中指定和实施接口规范?
- 为什么没有goto?
- 为什么原始字符串(r-strings)不能以反斜杠结尾?
- 为什么Python没有属性赋值的“with”语句?
- 生成器为什么不支持 with 语句?
- 为什么 if/while/def/class语句需要冒号?
- 为什么Python在列表和元组的末尾允许使用逗号?
- 代码库和插件 FAQ
- 扩展/嵌入常见问题
- 可以使用 C 语言创建自己的函数吗?
- 可以使用 C++ 语言创建自己的函数吗?
- C很难写,有没有其他选择?
- 如何在 C 中执行任意 Python 语句?
- 如何在 C 中对任意 Python 表达式求值?
- 如何从Python对象中提取C的值?
- 如何使用Py_BuildValue()创建任意长度的元组?
- 如何从C调用对象的方法?
- 如何捕获PyErr_Print()(或打印到stdout / stderr的任何内容)的输出?
- 如何从C访问用Python编写的模块?
- 如何在 Python 中对接 C ++ 对象?
- 我使用Setup文件添加了一个模块,为什么make失败了?
- 如何调试扩展?
- 我想在Linux系统上编译一个Python模块,但是缺少一些文件。为什么?
- 如何区分“输入不完整”和“输入无效”?
- 如何找到未定义的g++符号__builtin_new或__pure_virtual?
- 能否创建一个对象类,其中部分方法在C中实现,而其他方法在Python中实现(例如通过继承)?
- Python在Windows上的常见问题
- 图形用户界面(GUI)常见问题
- “为什么我的电脑上安装了 Python ?”
- 术语对照表
- 文档说明
- 处理错误
- 版权所有
- 历史和许可证