Python 說明文件內容¶
- Python 有什麼新功能?
- Python 3.12 有什麼新功能
- Python 3.11 有什麼新功能
- Python 3.10 有什麼新功能
- 摘要 -- 發布重點
- 新功能
- 與型別提示相關的新功能
- 其他語言更動
- 新模組
- 改進的模組
- 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 和 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
- 最佳化
- 已棄用
- 已刪除
- 移植到 Python 3.10
- CPython 位元組碼更改
- 建置變更
- C API 變更
- Python 3.9 有什麼新功能
- 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
- 其他語言更動
- 新增模組
- 改進的模組
- 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
- 最佳化
- Build and C API Changes
- 已棄用
- 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
- 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
typingmodule and Generic Types - PEP 552: Hash-based .pyc Files
- PEP 545:Python 文件翻譯
- Python Development Mode (-X dev)
- 其他語言更動
- 新模組
- 改進的模組
- 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 變更
- Build Changes
- 最佳化
- 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
- 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
- 其他語言更動
- 新模組
- 改進的模組
- 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
- 最佳化
- Build and C API Changes
- Other Improvements
- 已棄用
- 已移除
- 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
- Python 3.4 有什麼新功能
- 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
- 其他語言更動
- 新增模組
- 改進的模組
- 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
- 最佳化
- Build and C API Changes
- 已棄用
- 已移除
- Porting to Python 3.5
- Notable changes in Python 3.5.4
- Python 3.4 有什麼新功能
- Summary -- Release Highlights
- New Features
- 新模組
- 改進的模組
- abc
- aifc
- argparse
- audioop
- base64
- collections
- colorsys
- contextlib
- dbm
- dis
- doctest
- filecmp
- functools
- gc
- glob
- hashlib
- hmac
- html
- http
- idlelib 與 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 實作變更
- 已棄用
- 已移除
- Porting to Python 3.4
- 3.4.3 中的變更
- Python 3.3 有什麼新功能
- Summary -- Release highlights
- PEP 405:虛擬環境
- PEP 420: Implicit Namespace Packages
- PEP 3118: New memoryview implementation and buffer protocol documentation
- PEP 393: Flexible String Representation
- PEP 397:適用於 Windows 的 Python 啟動器
- 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:函式簽名物件
- PEP 421:新增 sys.implementation
- 使用 importlib 作為 import 的實作
- 其他語言更動
- A Finer-Grained Import Lock
- 內建函式和型別
- 新模組
- 改進的模組
- 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
- 最佳化
- 建置和 C API 更改
- 已棄用
- 移植到 Python 3.3
- 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.futuresmodule - PEP 3147: PYC Repository Directories
- PEP 3149: ABI Version Tagged .so Files
- PEP 3333: Python Web Server Gateway Interface v1.0.1
- 其他語言更動
- New, Improved, and Deprecated Modules
- elementtree
- functools
- itertools
- collections
- threading
- datetime 和 time
- math
- abc
- io
- reprlib
- logging
- csv
- contextlib
- decimal and fractions
- ftp
- popen
- select
- gzip 和 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
- 最佳化
- Unicode
- Codecs
- 文件
- IDLE
- Code Repository
- Build and C API Changes
- Porting to Python 3.2
- Python 3.1 有什麼新功能
- Python 3.0 有什麼新功能
- 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
- 其他語言更動
- 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-allbuild target - Removal of
make touchbuild target
- 致謝
- 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-packagesDirectory - PEP 371: The
multiprocessingPackage - PEP 3101: Advanced String Formatting
- PEP 3105:
printAs a Function - PEP 3110: Exception-Handling Changes
- PEP 3112: Byte Literals
- PEP 3116: New I/O Library
- PEP 3118:修訂緩衝協定
- PEP 3119: Abstract Base Classes
- PEP 3127: Integer Literal Support and Syntax
- PEP 3129: Class Decorators
- PEP 3141: A Type Hierarchy for Numbers
- 其他語言更動
- New and Improved Modules
- Deprecations and Removals
- Build and C API Changes
- Porting to Python 2.6
- 致謝
- 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
- 其他語言更動
- New, Improved, and Removed Modules
- Build and C API Changes
- Porting to Python 2.5
- 致謝
- 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
- 其他語言更動
- New, Improved, and Deprecated Modules
- Build and C API Changes
- Porting to Python 2.4
- 致謝
- 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
- 其他語言更動
- New, Improved, and Deprecated Modules
- Pymalloc: A Specialized Object Allocator
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.3
- 致謝
- Python 2.2 有什麼新功能
- Python 2.1 有什麼新功能
- 簡介
- 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
- 致謝
- Python 2.0 有什麼新功能
- 簡介
- What About Python 1.6?
- New Development Process
- Unicode
- 串列綜合運算(List Comprehension)
- 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 模組
- 模組變更
- 新增模組
- IDLE Improvements
- Deleted and Deprecated Modules
- 致謝
- Changelog(更動日誌)
- Python next
- Python 3.12.1 final
- Python 3.12.0 final
- Python 3.12.0 release candidate 3
- Python 3.12.0 release candidate 2
- Python 3.12.0 release candidate 1
- Python 3.12.0 beta 4
- Python 3.12.0 beta 3
- Python 3.12.0 beta 2
- Python 3.12.0 beta 1
- Python 3.12.0 alpha 7
- Python 3.12.0 alpha 6
- Python 3.12.0 alpha 5
- Python 3.12.0 alpha 4
- Python 3.12.0 alpha 3
- Python 3.12.0 alpha 2
- Python 3.12.0 alpha 1
- 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. 深入了解流程控制
- 4.1.
if陳述式 - 4.2.
for陳述式 - 4.3.
range()函式 - 4.4. 迴圈內的
break和continue陳述式及else子句 - 4.5.
pass陳述式 - 4.6.
match陳述式 - 4.7. 定義函式 (function)
- 4.8. 深入了解函式定義
- 4.9. 間奏曲:程式碼風格 (Coding Style)
- 4.1.
- 5. 資料結構
- 6. 模組 (Module)
- 7. 輸入和輸出
- 8. 錯誤和例外
- 9. Class(類別)
- 10. Python 標準函式庫概覽
- 11. Python 標準函式庫概覽——第二部份
- 12. 虛擬環境與套件
- 13. 現在可以來學習些什麼?
- 14. 互動式輸入編輯和歷史記錄替換
- 15. 浮點數運算:問題與限制
- 16. 附錄
- Python 的設置與使用
- 1. 命令列與環境
- 2. 在 Unix 平臺上使用 Python
- 3. 配置 Python
- 4. 在 Windows 上使用 Python
- 4.1. The full installer
- 4.2. The Microsoft Store package
- 4.3. nuget.org 套件
- 4.4. The embeddable package
- 4.5. Alternative bundles
- 4.6. 設定 Python
- 4.7. UTF-8 模式
- 4.8. Python Launcher for Windows
- 4.9. Finding modules
- 4.10. Additional modules
- 4.11. 編譯 Python 在 Windows
- 4.12. 其他平台
- 5. 在 Mac 系統使用 Python
- 6. 編輯器與 IDE
- Python 語言參考手冊
- 1. 簡介
- 2. Lexical analysis
- 3. Data model
- 3.1. Objects, values and types
- 3.2. 標準型別階層
- 3.2.1. None
- 3.2.2. NotImplemented
- 3.2.3. Ellipsis
- 3.2.4.
numbers.Number - 3.2.5. Sequences
- 3.2.6. Set types
- 3.2.7. Mappings
- 3.2.8. Callable types
- 3.2.8.1. User-defined functions
- 3.2.8.2. Instance methods
- 3.2.8.3. Generator functions
- 3.2.8.4. Coroutine functions
- 3.2.8.5. Asynchronous generator functions
- 3.2.8.6. Built-in functions
- 3.2.8.7. Built-in methods
- 3.2.8.8. Classes
- 3.2.8.9. Class Instances
- 3.2.9. 模組
- 3.2.10. Custom classes
- 3.2.11. Class instances
- 3.2.12. I/O objects (also known as file objects)
- 3.2.13. Internal types
- 3.2.13.1. Code objects
- 3.2.13.1.1. Special read-only attributes
codeobject.co_namecodeobject.co_qualnamecodeobject.co_argcountcodeobject.co_posonlyargcountcodeobject.co_kwonlyargcountcodeobject.co_nlocalscodeobject.co_varnamescodeobject.co_cellvarscodeobject.co_freevarscodeobject.co_codecodeobject.co_constscodeobject.co_namescodeobject.co_filenamecodeobject.co_firstlinenocodeobject.co_lnotabcodeobject.co_stacksizecodeobject.co_flags
- 3.2.13.1.2. Methods on code objects
- 3.2.13.1.1. Special read-only attributes
- 3.2.13.2. Frame objects
- 3.2.13.3. Traceback objects
- 3.2.13.4. Slice objects
- 3.2.13.5. Static method objects
- 3.2.13.6. Class method objects
- 3.2.13.1. Code objects
- 3.3. Special method names
- 3.3.1. Basic customization
- 3.3.2. Customizing attribute access
- 3.3.3. Customizing class creation
- 3.3.4. Customizing instance and subclass checks
- 3.3.5. Emulating generic types
- 3.3.6. Emulating callable objects
- 3.3.7. Emulating container types
- 3.3.8. Emulating numeric types
object.__add__()object.__sub__()object.__mul__()object.__matmul__()object.__truediv__()object.__floordiv__()object.__mod__()object.__divmod__()object.__pow__()object.__lshift__()object.__rshift__()object.__and__()object.__xor__()object.__or__()object.__radd__()object.__rsub__()object.__rmul__()object.__rmatmul__()object.__rtruediv__()object.__rfloordiv__()object.__rmod__()object.__rdivmod__()object.__rpow__()object.__rlshift__()object.__rrshift__()object.__rand__()object.__rxor__()object.__ror__()object.__iadd__()object.__isub__()object.__imul__()object.__imatmul__()object.__itruediv__()object.__ifloordiv__()object.__imod__()object.__ipow__()object.__ilshift__()object.__irshift__()object.__iand__()object.__ixor__()object.__ior__()object.__neg__()object.__pos__()object.__abs__()object.__invert__()object.__complex__()object.__int__()object.__float__()object.__index__()object.__round__()object.__trunc__()object.__floor__()object.__ceil__()
- 3.3.9. With Statement Context Managers
- 3.3.10. Customizing positional arguments in class pattern matching
- 3.3.11. Emulating buffer types
- 3.3.12. Special method lookup
- 3.4. 協程
- 4. Execution model
- 5. The import system
- 6. Expressions
- 6.1. Arithmetic conversions
- 6.2. Atoms
- 6.3. Primaries
- 6.4. Await expression
- 6.5. The power operator
- 6.6. Unary arithmetic and bitwise operations
- 6.7. Binary arithmetic operations
- 6.8. Shifting operations
- 6.9. Binary bitwise operations
- 6.10. Comparisons
- 6.11. Boolean operations
- 6.12. Assignment expressions
- 6.13. Conditional expressions
- 6.14. Lambdas
- 6.15. Expression lists
- 6.16. Evaluation order
- 6.17. Operator precedence
- 7. Simple statements
- 7.1. Expression statements
- 7.2. Assignment statements
- 7.3. The
assertstatement - 7.4. The
passstatement - 7.5. The
delstatement - 7.6. The
returnstatement - 7.7. The
yieldstatement - 7.8. The
raisestatement - 7.9. The
breakstatement - 7.10. The
continuestatement - 7.11. The
importstatement - 7.12. The
globalstatement - 7.13. The
nonlocalstatement - 7.14. The
typestatement
- 8. Compound statements
- 9. 最高層級元件
- 10. 完整的語法規格書
- Python 標準函式庫 (Standard Library)
- 簡介
- 內建函式
abs()aiter()all()anext()any()ascii()bin()boolbreakpoint()callable()chr()classmethod()compile()complexdelattr()dir()divmod()enumerate()eval()exec()filter()floatformat()getattr()globals()hasattr()hash()help()hex()id()input()intisinstance()issubclass()iter()len()locals()map()max()min()next()objectoct()open()ord()pow()print()propertyrepr()reversed()round()setattr()slicesorted()staticmethod()sum()supertypevars()zip()__import__()
- 內建常數
- 內建型別
- 真值檢測
- Boolean(布林)運算 ---
and,or,not - 比較運算
- Numeric Types ---
int,float,complex - Boolean Type -
bool - Iterator Types
- Sequence Types ---
list,tuple,range - Text Sequence Type ---
strstr- String Methods
str.capitalize()str.casefold()str.center()str.count()str.encode()str.endswith()str.expandtabs()str.find()str.format()str.format_map()str.index()str.isalnum()str.isalpha()str.isascii()str.isdecimal()str.isdigit()str.isidentifier()str.islower()str.isnumeric()str.isprintable()str.isspace()str.istitle()str.isupper()str.join()str.ljust()str.lower()str.lstrip()str.maketrans()str.partition()str.removeprefix()str.removesuffix()str.replace()str.rfind()str.rindex()str.rjust()str.rpartition()str.rsplit()str.rstrip()str.split()str.splitlines()str.startswith()str.strip()str.swapcase()str.title()str.translate()str.upper()str.zfill()
printf-style String Formatting
- Binary Sequence Types ---
bytes,bytearray,memoryview- Bytes Objects
- Bytearray Objects
- Bytes and Bytearray Operations
bytes.count()bytearray.count()bytes.removeprefix()bytearray.removeprefix()bytes.removesuffix()bytearray.removesuffix()bytes.decode()bytearray.decode()bytes.endswith()bytearray.endswith()bytes.find()bytearray.find()bytes.index()bytearray.index()bytes.join()bytearray.join()bytes.maketrans()bytearray.maketrans()bytes.partition()bytearray.partition()bytes.replace()bytearray.replace()bytes.rfind()bytearray.rfind()bytes.rindex()bytearray.rindex()bytes.rpartition()bytearray.rpartition()bytes.startswith()bytearray.startswith()bytes.translate()bytearray.translate()bytes.center()bytearray.center()bytes.ljust()bytearray.ljust()bytes.lstrip()bytearray.lstrip()bytes.rjust()bytearray.rjust()bytes.rsplit()bytearray.rsplit()bytes.rstrip()bytearray.rstrip()bytes.split()bytearray.split()bytes.strip()bytearray.strip()bytes.capitalize()bytearray.capitalize()bytes.expandtabs()bytearray.expandtabs()bytes.isalnum()bytearray.isalnum()bytes.isalpha()bytearray.isalpha()bytes.isascii()bytearray.isascii()bytes.isdigit()bytearray.isdigit()bytes.islower()bytearray.islower()bytes.isspace()bytearray.isspace()bytes.istitle()bytearray.istitle()bytes.isupper()bytearray.isupper()bytes.lower()bytearray.lower()bytes.splitlines()bytearray.splitlines()bytes.swapcase()bytearray.swapcase()bytes.title()bytearray.title()bytes.upper()bytearray.upper()bytes.zfill()bytearray.zfill()
printf-style Bytes Formatting- Memory Views
memoryviewmemoryview.__eq__()memoryview.tobytes()memoryview.hex()memoryview.tolist()memoryview.toreadonly()memoryview.release()memoryview.cast()memoryview.objmemoryview.nbytesmemoryview.readonlymemoryview.formatmemoryview.itemsizememoryview.ndimmemoryview.shapememoryview.stridesmemoryview.suboffsetsmemoryview.c_contiguousmemoryview.f_contiguousmemoryview.contiguous
- Set Types ---
set,frozensetsetfrozensetfrozenset.isdisjoint()frozenset.issubset()frozenset.issuperset()frozenset.union()frozenset.intersection()frozenset.difference()frozenset.symmetric_difference()frozenset.copy()frozenset.update()frozenset.intersection_update()frozenset.difference_update()frozenset.symmetric_difference_update()frozenset.add()frozenset.remove()frozenset.discard()frozenset.pop()frozenset.clear()
- Mapping Types ---
dict - Context Manager Types
- Type Annotation Types --- Generic Alias, Union
- Other Built-in Types
- Special Attributes
- Integer string conversion length limitation
- 內建的例外
- Exception context
- 繼承自內建的例外
- Base classes
- Concrete exceptions
AssertionErrorAttributeErrorEOFErrorFloatingPointErrorGeneratorExitImportErrorModuleNotFoundErrorIndexErrorKeyErrorKeyboardInterruptMemoryErrorNameErrorNotImplementedErrorOSErrorOverflowErrorRecursionErrorReferenceErrorRuntimeErrorStopIterationStopAsyncIterationSyntaxErrorIndentationErrorTabErrorSystemErrorSystemExitTypeErrorUnboundLocalErrorUnicodeErrorUnicodeEncodeErrorUnicodeDecodeErrorUnicodeTranslateErrorValueErrorZeroDivisionErrorEnvironmentErrorIOErrorWindowsError- OS exceptions
- 警告
- Exception groups
- Exception hierarchy
- 文本處理 (Text Processing) 服務
string--- 常見的字串操作re--- 正規表示式 (regular expression) 操作difflib--- Helpers for computing deltasDifferHtmlDiffcontext_diff()get_close_matches()ndiff()restore()unified_diff()diff_bytes()IS_LINE_JUNK()IS_CHARACTER_JUNK()- SequenceMatcher 物件
SequenceMatcherSequenceMatcher.set_seqs()SequenceMatcher.set_seq1()SequenceMatcher.set_seq2()SequenceMatcher.find_longest_match()SequenceMatcher.get_matching_blocks()SequenceMatcher.get_opcodes()SequenceMatcher.get_grouped_opcodes()SequenceMatcher.ratio()SequenceMatcher.quick_ratio()SequenceMatcher.real_quick_ratio()
- SequenceMatcher 範例
- Differ Objects
- Differ Example
- A command-line interface to difflib
- ndiff 範例:
textwrap--- Text wrapping and fillingwrap()fill()shorten()dedent()indent()TextWrapperTextWrapper.widthTextWrapper.expand_tabsTextWrapper.tabsizeTextWrapper.replace_whitespaceTextWrapper.drop_whitespaceTextWrapper.initial_indentTextWrapper.subsequent_indentTextWrapper.fix_sentence_endingsTextWrapper.break_long_wordsTextWrapper.break_on_hyphensTextWrapper.max_linesTextWrapper.placeholderTextWrapper.wrap()TextWrapper.fill()
unicodedata--- Unicode Databasestringprep--- Internet String Preparationreadline--- GNU readline interfacerlcompleter--- Completion function for GNU readline
- 二進位資料服務
struct--- Interpret bytes as packed binary datacodecs--- Codec registry and base classesencode()decode()lookup()CodecInfogetencoder()getdecoder()getincrementalencoder()getincrementaldecoder()getreader()getwriter()register()unregister()open()EncodedFile()iterencode()iterdecode()BOMBOM_BEBOM_LEBOM_UTF8BOM_UTF16BOM_UTF16_BEBOM_UTF16_LEBOM_UTF32BOM_UTF32_BEBOM_UTF32_LE- Codec Base Classes
- Encodings and Unicode
- Standard Encodings
- Python Specific Encodings
encodings.idna--- Internationalized Domain Names in Applicationsencodings.mbcs--- Windows ANSI codepageencodings.utf_8_sig--- UTF-8 codec with BOM signature
- 資料型別
datetime--- 日期與時間的基本型別- Aware and Naive Objects
- 常數
- Available Types
timedelta物件date物件datedate.today()date.fromtimestamp()date.fromordinal()date.fromisoformat()date.fromisocalendar()date.mindate.maxdate.resolutiondate.yeardate.monthdate.daydate.replace()date.timetuple()date.toordinal()date.weekday()date.isoweekday()date.isocalendar()date.isoformat()date.__str__()date.ctime()date.strftime()date.__format__()
- 用法範例:
date
datetime物件datetimedatetime.today()datetime.now()datetime.utcnow()datetime.fromtimestamp()datetime.utcfromtimestamp()datetime.fromordinal()datetime.combine()datetime.fromisoformat()datetime.fromisocalendar()datetime.strptime()datetime.mindatetime.maxdatetime.resolutiondatetime.yeardatetime.monthdatetime.daydatetime.hourdatetime.minutedatetime.seconddatetime.microseconddatetime.tzinfodatetime.folddatetime.date()datetime.time()datetime.timetz()datetime.replace()datetime.astimezone()datetime.utcoffset()datetime.dst()datetime.tzname()datetime.timetuple()datetime.utctimetuple()datetime.toordinal()datetime.timestamp()datetime.weekday()datetime.isoweekday()datetime.isocalendar()datetime.isoformat()datetime.__str__()datetime.ctime()datetime.strftime()datetime.__format__()
- Examples of Usage:
datetime
time物件tzinfo物件timezone物件strftime()與strptime()的行為
zoneinfo--- IANA 時區支援calendar--- 日曆相關函式CalendarCalendar.iterweekdays()Calendar.itermonthdates()Calendar.itermonthdays()Calendar.itermonthdays2()Calendar.itermonthdays3()Calendar.itermonthdays4()Calendar.monthdatescalendar()Calendar.monthdays2calendar()Calendar.monthdayscalendar()Calendar.yeardatescalendar()Calendar.yeardays2calendar()Calendar.yeardayscalendar()
TextCalendarHTMLCalendarHTMLCalendar.formatmonth()HTMLCalendar.formatyear()HTMLCalendar.formatyearpage()HTMLCalendar.formatmonthname()HTMLCalendar.cssclassesHTMLCalendar.cssclass_nodayHTMLCalendar.cssclasses_weekday_headHTMLCalendar.cssclass_month_headHTMLCalendar.cssclass_monthHTMLCalendar.cssclass_yearHTMLCalendar.cssclass_year_head
LocaleTextCalendarLocaleHTMLCalendarsetfirstweekday()firstweekday()isleap()leapdays()weekday()weekheader()monthrange()monthcalendar()prmonth()month()prcal()calendar()timegm()day_nameday_abbrMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYDaymonth_namemonth_abbrJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERMonthIllegalMonthErrorIllegalWeekdayError- 命令列用法
collections--- 容器資料型態collections.abc--- Abstract Base Classes for Containersheapq--- 堆積佇列 (heap queue) 演算法bisect--- 陣列二分演算法 (Array bisection algorithm)array--- 高效率的數值型陣列typecodesarrayarray.typecodearray.itemsizearray.append()array.buffer_info()array.byteswap()array.count()array.extend()array.frombytes()array.fromfile()array.fromlist()array.fromunicode()array.index()array.insert()array.pop()array.remove()array.reverse()array.tobytes()array.tofile()array.tolist()array.tounicode()
weakref--- Weak referencestypes--- Dynamic type creation and names for built-in types- Dynamic Type Creation
- Standard Interpreter Types
NoneTypeFunctionTypeLambdaTypeGeneratorTypeCoroutineTypeAsyncGeneratorTypeCodeTypeCellTypeMethodTypeBuiltinFunctionTypeBuiltinMethodTypeWrapperDescriptorTypeMethodWrapperTypeNotImplementedTypeMethodDescriptorTypeClassMethodDescriptorTypeModuleTypeEllipsisTypeGenericAliasUnionTypeTracebackTypeFrameTypeGetSetDescriptorTypeMemberDescriptorTypeMappingProxyType
- Additional Utility Classes and Functions
- Coroutine Utility Functions
copy--- 淺層 (shallow) 和深層 (deep) 複製操作pprint--- Data pretty printerreprlib--- Alternaterepr()implementationenum--- 對列舉的支援graphlib—-- 使用類圖 (graph-like) 結構進行操作的功能
- 數值與數學模組
numbers--- 數值的抽象基底類別math--- 數學函式cmath--- Mathematical functions for complex numbersdecimal--- Decimal fixed point and floating point arithmetic- Quick-start Tutorial
- Decimal objects
DecimalDecimal.adjusted()Decimal.as_integer_ratio()Decimal.as_tuple()Decimal.canonical()Decimal.compare()Decimal.compare_signal()Decimal.compare_total()Decimal.compare_total_mag()Decimal.conjugate()Decimal.copy_abs()Decimal.copy_negate()Decimal.copy_sign()Decimal.exp()Decimal.from_float()Decimal.fma()Decimal.is_canonical()Decimal.is_finite()Decimal.is_infinite()Decimal.is_nan()Decimal.is_normal()Decimal.is_qnan()Decimal.is_signed()Decimal.is_snan()Decimal.is_subnormal()Decimal.is_zero()Decimal.ln()Decimal.log10()Decimal.logb()Decimal.logical_and()Decimal.logical_invert()Decimal.logical_or()Decimal.logical_xor()Decimal.max()Decimal.max_mag()Decimal.min()Decimal.min_mag()Decimal.next_minus()Decimal.next_plus()Decimal.next_toward()Decimal.normalize()Decimal.number_class()Decimal.quantize()Decimal.radix()Decimal.remainder_near()Decimal.rotate()Decimal.same_quantum()Decimal.scaleb()Decimal.shift()Decimal.sqrt()Decimal.to_eng_string()Decimal.to_integral()Decimal.to_integral_exact()Decimal.to_integral_value()
- Logical operands
- Context objects
getcontext()setcontext()localcontext()BasicContextExtendedContextDefaultContextContextContext.clear_flags()Context.clear_traps()Context.copy()Context.copy_decimal()Context.create_decimal()Context.create_decimal_from_float()Context.Etiny()Context.Etop()Context.abs()Context.add()Context.canonical()Context.compare()Context.compare_signal()Context.compare_total()Context.compare_total_mag()Context.copy_abs()Context.copy_negate()Context.copy_sign()Context.divide()Context.divide_int()Context.divmod()Context.exp()Context.fma()Context.is_canonical()Context.is_finite()Context.is_infinite()Context.is_nan()Context.is_normal()Context.is_qnan()Context.is_signed()Context.is_snan()Context.is_subnormal()Context.is_zero()Context.ln()Context.log10()Context.logb()Context.logical_and()Context.logical_invert()Context.logical_or()Context.logical_xor()Context.max()Context.max_mag()Context.min()Context.min_mag()Context.minus()Context.multiply()Context.next_minus()Context.next_plus()Context.next_toward()Context.normalize()Context.number_class()Context.plus()Context.power()Context.quantize()Context.radix()Context.remainder()Context.remainder_near()Context.rotate()Context.same_quantum()Context.scaleb()Context.shift()Context.sqrt()Context.subtract()Context.to_eng_string()Context.to_integral_exact()Context.to_sci_string()
- 常數
- Rounding modes
- Signals
- Floating Point Notes
- Working with threads
- Recipes
- Decimal FAQ
fractions--- Rational numbersrandom--- 生成偽隨機數statistics--- 數學統計函式
- 函式編程模組
itertools--- 建立產生高效率迴圈之疊代器的函式functools--- Higher-order functions and operations on callable objectsoperator--- 標準運算子替代函式lt()le()eq()ne()ge()gt()__lt__()__le__()__eq__()__ne__()__ge__()__gt__()not_()__not__()truth()is_()is_not()abs()__abs__()add()__add__()and_()__and__()floordiv()__floordiv__()index()__index__()inv()invert()__inv__()__invert__()lshift()__lshift__()mod()__mod__()mul()__mul__()matmul()__matmul__()neg()__neg__()or_()__or__()pos()__pos__()pow()__pow__()rshift()__rshift__()sub()__sub__()truediv()__truediv__()xor()__xor__()concat()__concat__()contains()__contains__()countOf()delitem()__delitem__()getitem()__getitem__()indexOf()setitem()__setitem__()length_hint()call()__call__()attrgetter()itemgetter()methodcaller()- 運算子與函式間的對映
- 原地 (in-place) 運算子
- 檔案與目錄存取
pathlib--- 物件導向檔案系統路徑- 基本用法
- 純路徑
PurePathPurePosixPathPureWindowsPath- 通用屬性
- 運算子
- 對個別組成的存取
- 方法與屬性
PurePath.drivePurePath.rootPurePath.anchorPurePath.parentsPurePath.parentPurePath.namePurePath.suffixPurePath.suffixesPurePath.stemPurePath.as_posix()PurePath.as_uri()PurePath.is_absolute()PurePath.is_relative_to()PurePath.is_reserved()PurePath.joinpath()PurePath.match()PurePath.relative_to()PurePath.with_name()PurePath.with_stem()PurePath.with_suffix()PurePath.with_segments()
- Concrete paths
PathPosixPathWindowsPath- Methods
Path.cwd()Path.home()Path.stat()Path.chmod()Path.exists()Path.expanduser()Path.glob()Path.group()Path.is_dir()Path.is_file()Path.is_junction()Path.is_mount()Path.is_symlink()Path.is_socket()Path.is_fifo()Path.is_block_device()Path.is_char_device()Path.iterdir()Path.walk()Path.lchmod()Path.lstat()Path.mkdir()Path.open()Path.owner()Path.read_bytes()Path.read_text()Path.readlink()Path.rename()Path.replace()Path.absolute()Path.resolve()Path.rglob()Path.rmdir()Path.samefile()Path.symlink_to()Path.hardlink_to()Path.touch()Path.unlink()Path.write_bytes()Path.write_text()
- Correspondence to tools in the
osmodule
os.path--- 常見的路徑名操作abspath()basename()commonpath()commonprefix()dirname()exists()lexists()expanduser()expandvars()getatime()getmtime()getctime()getsize()isabs()isfile()isdir()isjunction()islink()ismount()isdevdrive()join()normcase()normpath()realpath()relpath()samefile()sameopenfile()samestat()split()splitdrive()splitroot()splitext()supports_unicode_filenames
fileinput--- Iterate over lines from multiple input streamsstat--- Interpretingstat()resultsS_ISDIR()S_ISCHR()S_ISBLK()S_ISREG()S_ISFIFO()S_ISLNK()S_ISSOCK()S_ISDOOR()S_ISPORT()S_ISWHT()S_IMODE()S_IFMT()filemode()ST_MODEST_INOST_DEVST_NLINKST_UIDST_GIDST_SIZEST_ATIMEST_MTIMEST_CTIMES_IFSOCKS_IFLNKS_IFREGS_IFBLKS_IFDIRS_IFCHRS_IFIFOS_IFDOORS_IFPORTS_IFWHTS_ISUIDS_ISGIDS_ISVTXS_IRWXUS_IRUSRS_IWUSRS_IXUSRS_IRWXGS_IRGRPS_IWGRPS_IXGRPS_IRWXOS_IROTHS_IWOTHS_IXOTHS_ENFMTS_IREADS_IWRITES_IEXECUF_NODUMPUF_IMMUTABLEUF_APPENDUF_OPAQUEUF_NOUNLINKUF_COMPRESSEDUF_HIDDENSF_ARCHIVEDSF_IMMUTABLESF_APPENDSF_NOUNLINKSF_SNAPSHOTFILE_ATTRIBUTE_ARCHIVEFILE_ATTRIBUTE_COMPRESSEDFILE_ATTRIBUTE_DEVICEFILE_ATTRIBUTE_DIRECTORYFILE_ATTRIBUTE_ENCRYPTEDFILE_ATTRIBUTE_HIDDENFILE_ATTRIBUTE_INTEGRITY_STREAMFILE_ATTRIBUTE_NORMALFILE_ATTRIBUTE_NOT_CONTENT_INDEXEDFILE_ATTRIBUTE_NO_SCRUB_DATAFILE_ATTRIBUTE_OFFLINEFILE_ATTRIBUTE_READONLYFILE_ATTRIBUTE_REPARSE_POINTFILE_ATTRIBUTE_SPARSE_FILEFILE_ATTRIBUTE_SYSTEMFILE_ATTRIBUTE_TEMPORARYFILE_ATTRIBUTE_VIRTUALIO_REPARSE_TAG_SYMLINKIO_REPARSE_TAG_MOUNT_POINTIO_REPARSE_TAG_APPEXECLINK
filecmp--- File and Directory Comparisonscmp()cmpfiles()clear_cache()- The
dircmpclassdircmpdircmp.report()dircmp.report_partial_closure()dircmp.report_full_closure()dircmp.leftdircmp.rightdircmp.left_listdircmp.right_listdircmp.commondircmp.left_onlydircmp.right_onlydircmp.common_dirsdircmp.common_filesdircmp.common_funnydircmp.same_filesdircmp.diff_filesdircmp.funny_filesdircmp.subdirs
DEFAULT_IGNORES
tempfile--- 生成臨時檔案和目錄glob--- Unix 風格的路徑名稱模式擴展fnmatch--- Unix filename pattern matchinglinecache--- Random access to text linesshutil--- High-level file operations
- Data Persistence
pickle--- Python object serialization- Relationship to other Python modules
- Data stream format
- 模組介面
- What can be pickled and unpickled?
- Pickling Class Instances
- Custom Reduction for Types, Functions, and Other Objects
- Out-of-band Buffers
- Restricting Globals
- Performance
- 範例
copyreg--- 註冊pickle支援函式shelve--- Python object persistencemarshal--- 内部 Python 物件序列化dbm--- Interfaces to Unix "databases"sqlite3--- SQLite 資料庫的 DB-API 2.0 介面- Tutorial
- Reference
- Module functions
- Module constants
LEGACY_TRANSACTION_CONTROLPARSE_COLNAMESPARSE_DECLTYPESSQLITE_OKSQLITE_DENYSQLITE_IGNOREapilevelparamstylesqlite_versionsqlite_version_infothreadsafetyversionversion_infoSQLITE_DBCONFIG_DEFENSIVESQLITE_DBCONFIG_DQS_DDLSQLITE_DBCONFIG_DQS_DMLSQLITE_DBCONFIG_ENABLE_FKEYSQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZERSQLITE_DBCONFIG_ENABLE_LOAD_EXTENSIONSQLITE_DBCONFIG_ENABLE_QPSGSQLITE_DBCONFIG_ENABLE_TRIGGERSQLITE_DBCONFIG_ENABLE_VIEWSQLITE_DBCONFIG_LEGACY_ALTER_TABLESQLITE_DBCONFIG_LEGACY_FILE_FORMATSQLITE_DBCONFIG_NO_CKPT_ON_CLOSESQLITE_DBCONFIG_RESET_DATABASESQLITE_DBCONFIG_TRIGGER_EQPSQLITE_DBCONFIG_TRUSTED_SCHEMASQLITE_DBCONFIG_WRITABLE_SCHEMA
- Connection 物件
ConnectionConnection.cursor()Connection.blobopen()Connection.commit()Connection.rollback()Connection.close()Connection.execute()Connection.executemany()Connection.executescript()Connection.create_function()Connection.create_aggregate()Connection.create_window_function()Connection.create_collation()Connection.interrupt()Connection.set_authorizer()Connection.set_progress_handler()Connection.set_trace_callback()Connection.enable_load_extension()Connection.load_extension()Connection.iterdump()Connection.backup()Connection.getlimit()Connection.setlimit()Connection.getconfig()Connection.setconfig()Connection.serialize()Connection.deserialize()Connection.autocommitConnection.in_transactionConnection.isolation_levelConnection.row_factoryConnection.text_factoryConnection.total_changes
- Cursor 物件
- Row 物件
- Blob 物件
- PrepareProtocol 物件
- 例外
- SQLite and Python types
- Default adapters and converters (deprecated)
- 命令列介面
- How-to guides
- How to use placeholders to bind values in SQL queries
- How to adapt custom Python types to SQLite values
- How to convert SQLite values to custom Python types
- Adapter and converter recipes
- How to use connection shortcut methods
- How to use the connection context manager
- How to work with SQLite URIs
- How to create and use row factories
- How to handle non-UTF-8 text encodings
- 解釋
- 資料壓縮與保存
zlib--- 相容於 gzip 的壓縮gzip--- gzip 檔案的支援bz2--- Support for bzip2 compressionlzma--- Compression using the LZMA algorithmzipfile--- Work with ZIP archivesBadZipFileBadZipfileLargeZipFileZipInfois_zipfile()ZIP_STOREDZIP_DEFLATEDZIP_BZIP2ZIP_LZMA- ZipFile 物件
- Path Objects
- PyZipFile 物件
- ZipInfo 物件
ZipInfo.from_file()ZipInfo.is_dir()ZipInfo.filenameZipInfo.date_timeZipInfo.compress_typeZipInfo.commentZipInfo.extraZipInfo.create_systemZipInfo.create_versionZipInfo.extract_versionZipInfo.reservedZipInfo.flag_bitsZipInfo.volumeZipInfo.internal_attrZipInfo.external_attrZipInfo.header_offsetZipInfo.CRCZipInfo.compress_sizeZipInfo.file_size
- Command-Line Interface
- Decompression pitfalls
tarfile--- Read and write tar archive filesopen()is_tarfile()TarErrorReadErrorCompressionErrorStreamErrorExtractErrorHeaderErrorFilterErrorAbsolutePathErrorOutsideDestinationErrorSpecialFileErrorAbsoluteLinkErrorLinkOutsideDestinationErrorENCODINGREGTYPEAREGTYPELNKTYPESYMTYPECHRTYPEBLKTYPEDIRTYPEFIFOTYPECONTTYPEGNUTYPE_LONGNAMEGNUTYPE_LONGLINKGNUTYPE_SPARSEUSTAR_FORMATGNU_FORMATPAX_FORMATDEFAULT_FORMAT- TarFile 物件
- TarInfo 物件
TarInfoTarInfo.frombuf()TarInfo.fromtarfile()TarInfo.tobuf()TarInfo.nameTarInfo.sizeTarInfo.mtimeTarInfo.modeTarInfo.typeTarInfo.linknameTarInfo.uidTarInfo.gidTarInfo.unameTarInfo.gnameTarInfo.pax_headersTarInfo.replace()TarInfo.isfile()TarInfo.isreg()TarInfo.isdir()TarInfo.issym()TarInfo.islnk()TarInfo.ischr()TarInfo.isblk()TarInfo.isfifo()TarInfo.isdev()
- Extraction filters
- Command-Line Interface
- 範例
- Supported tar formats
- Unicode issues
- 檔案格式
csv--- CSV 檔案讀取及寫入configparser--- Configuration file parser- Quick Start
- Supported Datatypes
- Fallback Values
- Supported INI File Structure
- Interpolation of values
- Mapping Protocol Access
- Customizing Parser Behaviour
- Legacy API Examples
- ConfigParser 物件
ConfigParserConfigParser.defaults()ConfigParser.sections()ConfigParser.add_section()ConfigParser.has_section()ConfigParser.options()ConfigParser.has_option()ConfigParser.read()ConfigParser.read_file()ConfigParser.read_string()ConfigParser.read_dict()ConfigParser.get()ConfigParser.getint()ConfigParser.getfloat()ConfigParser.getboolean()ConfigParser.items()ConfigParser.set()ConfigParser.write()ConfigParser.remove_option()ConfigParser.remove_section()ConfigParser.optionxform()
MAX_INTERPOLATION_DEPTH
- RawConfigParser 物件
- 例外
tomllib--- 剖析 TOML 檔案netrc--- netrc 檔案處理plistlib--- Generate and parse Apple.plistfiles
- 加密服務
- 通用作業系統服務
os--- 各種作業系統介面errorname- File Names, Command Line Arguments, and Environment Variables
- Python UTF-8 Mode
- Process Parameters
ctermid()environenvironbfsencode()fsdecode()fspath()PathLikegetenv()getenvb()get_exec_path()getegid()geteuid()getgid()getgrouplist()getgroups()getlogin()getpgid()getpgrp()getpid()getppid()getpriority()PRIO_PROCESSPRIO_PGRPPRIO_USERPRIO_DARWIN_THREADPRIO_DARWIN_PROCESSPRIO_DARWIN_BGPRIO_DARWIN_NONUIgetresuid()getresgid()getuid()initgroups()putenv()setegid()seteuid()setgid()setgroups()setns()setpgrp()setpgid()setpriority()setregid()setresgid()setresuid()setreuid()getsid()setsid()setuid()strerror()supports_bytes_environumask()uname()unsetenv()unshare()CLONE_FILESCLONE_FSCLONE_NEWCGROUPCLONE_NEWIPCCLONE_NEWNETCLONE_NEWNSCLONE_NEWPIDCLONE_NEWTIMECLONE_NEWUSERCLONE_NEWUTSCLONE_SIGHANDCLONE_SYSVSEMCLONE_THREADCLONE_VM
- File Object Creation
- File Descriptor Operations
close()closerange()copy_file_range()device_encoding()dup()dup2()fchmod()fchown()fdatasync()fpathconf()fstat()fstatvfs()fsync()ftruncate()get_blocking()isatty()lockf()F_LOCKF_TLOCKF_ULOCKF_TESTlogin_tty()lseek()SEEK_SETSEEK_CURSEEK_ENDSEEK_HOLESEEK_DATAopen()O_RDONLYO_WRONLYO_RDWRO_APPENDO_CREATO_EXCLO_TRUNCO_DSYNCO_RSYNCO_SYNCO_NDELAYO_NONBLOCKO_NOCTTYO_CLOEXECO_BINARYO_NOINHERITO_SHORT_LIVEDO_TEMPORARYO_RANDOMO_SEQUENTIALO_TEXTO_EVTONLYO_FSYNCO_SYMLINKO_NOFOLLOW_ANYO_ASYNCO_DIRECTO_DIRECTORYO_NOFOLLOWO_NOATIMEO_PATHO_TMPFILEO_SHLOCKO_EXLOCKopenpty()pipe()pipe2()posix_fallocate()posix_fadvise()POSIX_FADV_NORMALPOSIX_FADV_SEQUENTIALPOSIX_FADV_RANDOMPOSIX_FADV_NOREUSEPOSIX_FADV_WILLNEEDPOSIX_FADV_DONTNEEDpread()preadv()RWF_NOWAITRWF_HIPRIpwrite()pwritev()RWF_DSYNCRWF_SYNCRWF_APPENDread()sendfile()SF_NODISKIOSF_MNOWAITSF_SYNCSF_NOCACHEset_blocking()splice()SPLICE_F_MOVESPLICE_F_NONBLOCKSPLICE_F_MOREreadv()tcgetpgrp()tcsetpgrp()ttyname()write()writev()- Querying the size of a terminal
- Inheritance of File Descriptors
- Files and Directories
access()F_OKR_OKW_OKX_OKchdir()chflags()chmod()chown()chroot()fchdir()getcwd()getcwdb()lchflags()lchmod()lchown()link()listdir()listdrives()listmounts()listvolumes()lstat()mkdir()makedirs()mkfifo()mknod()major()minor()makedev()pathconf()pathconf_namesreadlink()remove()removedirs()rename()renames()replace()rmdir()scandir()DirEntrystat()stat_resultstat_result.st_modestat_result.st_inostat_result.st_devstat_result.st_nlinkstat_result.st_uidstat_result.st_gidstat_result.st_sizestat_result.st_atimestat_result.st_mtimestat_result.st_ctimestat_result.st_atime_nsstat_result.st_mtime_nsstat_result.st_ctime_nsstat_result.st_birthtimestat_result.st_birthtime_nsstat_result.st_blocksstat_result.st_blksizestat_result.st_rdevstat_result.st_flagsstat_result.st_genstat_result.st_fstypestat_result.st_rsizestat_result.st_creatorstat_result.st_typestat_result.st_file_attributesstat_result.st_reparse_tag
statvfs()supports_dir_fdsupports_effective_idssupports_fdsupports_follow_symlinkssymlink()sync()truncate()unlink()utime()walk()fwalk()memfd_create()MFD_CLOEXECMFD_ALLOW_SEALINGMFD_HUGETLBMFD_HUGE_SHIFTMFD_HUGE_MASKMFD_HUGE_64KBMFD_HUGE_512KBMFD_HUGE_1MBMFD_HUGE_2MBMFD_HUGE_8MBMFD_HUGE_16MBMFD_HUGE_32MBMFD_HUGE_256MBMFD_HUGE_512MBMFD_HUGE_1GBMFD_HUGE_2GBMFD_HUGE_16GBeventfd()eventfd_read()eventfd_write()EFD_CLOEXECEFD_NONBLOCKEFD_SEMAPHORE- Linux extended attributes
- Process Management
abort()add_dll_directory()execl()execle()execlp()execlpe()execv()execve()execvp()execvpe()_exit()EX_OKEX_USAGEEX_DATAERREX_NOINPUTEX_NOUSEREX_NOHOSTEX_UNAVAILABLEEX_SOFTWAREEX_OSERREX_OSFILEEX_CANTCREATEX_IOERREX_TEMPFAILEX_PROTOCOLEX_NOPERMEX_CONFIGEX_NOTFOUNDfork()forkpty()kill()killpg()nice()pidfd_open()PIDFD_NONBLOCKplock()popen()posix_spawn()POSIX_SPAWN_OPENPOSIX_SPAWN_CLOSEPOSIX_SPAWN_DUP2posix_spawnp()register_at_fork()spawnl()spawnle()spawnlp()spawnlpe()spawnv()spawnve()spawnvp()spawnvpe()P_NOWAITP_NOWAITOP_WAITP_DETACHP_OVERLAYstartfile()system()times()wait()waitid()waitpid()wait3()wait4()P_PIDP_PGIDP_ALLP_PIDFDWCONTINUEDWEXITEDWSTOPPEDWUNTRACEDWNOHANGWNOWAITCLD_EXITEDCLD_KILLEDCLD_DUMPEDCLD_TRAPPEDCLD_STOPPEDCLD_CONTINUEDwaitstatus_to_exitcode()WCOREDUMP()WIFCONTINUED()WIFSTOPPED()WIFSIGNALED()WIFEXITED()WEXITSTATUS()WSTOPSIG()WTERMSIG()
- Interface to the scheduler
SCHED_OTHERSCHED_BATCHSCHED_IDLESCHED_SPORADICSCHED_FIFOSCHED_RRSCHED_RESET_ON_FORKsched_paramsched_get_priority_min()sched_get_priority_max()sched_setscheduler()sched_getscheduler()sched_setparam()sched_getparam()sched_rr_get_interval()sched_yield()sched_setaffinity()sched_getaffinity()
- Miscellaneous System Information
- Random numbers
io— 處理資料串流的核心工具time--- Time access and conversions- 函式
asctime()pthread_getcpuclockid()clock_getres()clock_gettime()clock_gettime_ns()clock_settime()clock_settime_ns()ctime()get_clock_info()gmtime()localtime()mktime()monotonic()monotonic_ns()perf_counter()perf_counter_ns()process_time()process_time_ns()sleep()strftime()strptime()struct_timetime()time_ns()thread_time()thread_time_ns()tzset()
- Clock ID Constants
- Timezone Constants
- 函式
argparse--- Parser for command-line options, arguments and sub-commands- Core Functionality
- Quick Links for add_argument()
- 範例
- ArgumentParser 物件
- The add_argument() method
- The parse_args() method
- Other utilities
- Upgrading optparse code
- Exceptions
getopt--- C-style parser for command line optionslogging--- Python 的日誌記錄工具- Logger Objects
LoggerLogger.propagateLogger.setLevel()Logger.isEnabledFor()Logger.getEffectiveLevel()Logger.getChild()Logger.getChildren()Logger.debug()Logger.info()Logger.warning()Logger.error()Logger.critical()Logger.log()Logger.exception()Logger.addFilter()Logger.removeFilter()Logger.filter()Logger.addHandler()Logger.removeHandler()Logger.findCaller()Logger.handle()Logger.makeRecord()Logger.hasHandlers()
- Logging Levels
- Handler Objects
- Formatter Objects
- Filter Objects
- LogRecord 物件
- LogRecord attributes
- LoggerAdapter 物件
- Thread Safety
- Module-Level Functions
- Module-Level Attributes
- Integration with the warnings module
- Logger Objects
logging.config--- Logging configurationlogging.handlers--- Logging handlersgetpass--- 可攜式密碼輸入工具curses--- Terminal handling for character-cell displays- 函式
errorbaudrate()beep()can_change_color()cbreak()color_content()color_pair()curs_set()def_prog_mode()def_shell_mode()delay_output()doupdate()echo()endwin()erasechar()filter()flash()flushinp()getmouse()getsyx()getwin()has_colors()has_extended_color_support()has_ic()has_il()has_key()halfdelay()init_color()init_pair()initscr()is_term_resized()isendwin()keyname()killchar()longname()meta()mouseinterval()mousemask()napms()newpad()newwin()nl()nocbreak()noecho()nonl()noqiflush()noraw()pair_content()pair_number()putp()qiflush()raw()reset_prog_mode()reset_shell_mode()resetty()resize_term()resizeterm()savetty()get_escdelay()set_escdelay()get_tabsize()set_tabsize()setsyx()setupterm()start_color()termattrs()termname()tigetflag()tigetnum()tigetstr()tparm()typeahead()unctrl()ungetch()update_lines_cols()unget_wch()ungetmouse()use_env()use_default_colors()wrapper()
- Window Objects
window.addch()window.addnstr()window.addstr()window.attroff()window.attron()window.attrset()window.bkgd()window.bkgdset()window.border()window.box()window.chgat()window.clear()window.clearok()window.clrtobot()window.clrtoeol()window.cursyncup()window.delch()window.deleteln()window.derwin()window.echochar()window.enclose()window.encodingwindow.erase()window.getbegyx()window.getbkgd()window.getch()window.get_wch()window.getkey()window.getmaxyx()window.getparyx()window.getstr()window.getyx()window.hline()window.idcok()window.idlok()window.immedok()window.inch()window.insch()window.insdelln()window.insertln()window.insnstr()window.insstr()window.instr()window.is_linetouched()window.is_wintouched()window.keypad()window.leaveok()window.move()window.mvderwin()window.mvwin()window.nodelay()window.notimeout()window.noutrefresh()window.overlay()window.overwrite()window.putwin()window.redrawln()window.redrawwin()window.refresh()window.resize()window.scroll()window.scrollok()window.setscrreg()window.standend()window.standout()window.subpad()window.subwin()window.syncdown()window.syncok()window.syncup()window.timeout()window.touchline()window.touchwin()window.untouchwin()window.vline()
- Constants
ERROKversion__version__ncurses_versionCOLORSCOLOR_PAIRSCOLSLINESA_ALTCHARSETA_BLINKA_BOLDA_DIMA_INVISA_ITALICA_NORMALA_PROTECTA_REVERSEA_STANDOUTA_UNDERLINEA_HORIZONTALA_LEFTA_LOWA_RIGHTA_TOPA_VERTICALA_ATTRIBUTESA_CHARTEXTA_COLORKEY_MINKEY_BREAKKEY_DOWNKEY_UPKEY_LEFTKEY_RIGHTKEY_HOMEKEY_BACKSPACEKEY_F0KEY_FnKEY_DLKEY_ILKEY_DCKEY_ICKEY_EICKEY_CLEARKEY_EOSKEY_EOLKEY_SFKEY_SRKEY_NPAGEKEY_PPAGEKEY_STABKEY_CTABKEY_CATABKEY_ENTERKEY_SRESETKEY_RESETKEY_PRINTKEY_LLKEY_A1KEY_A3KEY_B2KEY_C1KEY_C3KEY_BTABKEY_BEGKEY_CANCELKEY_CLOSEKEY_COMMANDKEY_COPYKEY_CREATEKEY_ENDKEY_EXITKEY_FINDKEY_HELPKEY_MARKKEY_MESSAGEKEY_MOVEKEY_NEXTKEY_OPENKEY_OPTIONSKEY_PREVIOUSKEY_REDOKEY_REFERENCEKEY_REFRESHKEY_REPLACEKEY_RESTARTKEY_RESUMEKEY_SAVEKEY_SBEGKEY_SCANCELKEY_SCOMMANDKEY_SCOPYKEY_SCREATEKEY_SDCKEY_SDLKEY_SELECTKEY_SENDKEY_SEOLKEY_SEXITKEY_SFINDKEY_SHELPKEY_SHOMEKEY_SICKEY_SLEFTKEY_SMESSAGEKEY_SMOVEKEY_SNEXTKEY_SOPTIONSKEY_SPREVIOUSKEY_SPRINTKEY_SREDOKEY_SREPLACEKEY_SRIGHTKEY_SRSUMEKEY_SSAVEKEY_SSUSPENDKEY_SUNDOKEY_SUSPENDKEY_UNDOKEY_MOUSEKEY_RESIZEKEY_MAXACS_BBSSACS_BLOCKACS_BOARDACS_BSBSACS_BSSBACS_BSSSACS_BTEEACS_BULLETACS_CKBOARDACS_DARROWACS_DEGREEACS_DIAMONDACS_GEQUALACS_HLINEACS_LANTERNACS_LARROWACS_LEQUALACS_LLCORNERACS_LRCORNERACS_LTEEACS_NEQUALACS_PIACS_PLMINUSACS_PLUSACS_RARROWACS_RTEEACS_S1ACS_S3ACS_S7ACS_S9ACS_SBBSACS_SBSBACS_SBSSACS_SSBBACS_SSBSACS_SSSBACS_SSSSACS_STERLINGACS_TTEEACS_UARROWACS_ULCORNERACS_URCORNERACS_VLINEBUTTONn_PRESSEDBUTTONn_RELEASEDBUTTONn_CLICKEDBUTTONn_DOUBLE_CLICKEDBUTTONn_TRIPLE_CLICKEDBUTTON_SHIFTBUTTON_CTRLBUTTON_ALTCOLOR_BLACKCOLOR_BLUECOLOR_CYANCOLOR_GREENCOLOR_MAGENTACOLOR_REDCOLOR_WHITECOLOR_YELLOW
- 函式
curses.textpad--- Text input widget for curses programscurses.ascii--- ASCII 字元的工具程式NULSOHSTXETXEOTENQACKBELBSTABHTLFNLVTFFCRSOSIDLEDC1DC2DC3DC4NAKSYNETBCANEMSUBESCFSGSRSUSSPDELisalnum()isalpha()isascii()isblank()iscntrl()isdigit()isgraph()islower()isprint()ispunct()isspace()isupper()isxdigit()isctrl()ismeta()ascii()ctrl()alt()unctrl()controlnames
curses.panel--- A panel stack extension for cursesplatform--- 獲取底層平臺的標識資料errno--- Standard errno system symbolserrorcodeEPERMENOENTESRCHEINTREIOENXIOE2BIGENOEXECEBADFECHILDEAGAINENOMEMEACCESEFAULTENOTBLKEBUSYEEXISTEXDEVENODEVENOTDIREISDIREINVALENFILEEMFILEENOTTYETXTBSYEFBIGENOSPCESPIPEEROFSEMLINKEPIPEEDOMERANGEEDEADLKENAMETOOLONGENOLCKENOSYSENOTEMPTYELOOPEWOULDBLOCKENOMSGEIDRMECHRNGEL2NSYNCEL3HLTEL3RSTELNRNGEUNATCHENOCSIEL2HLTEBADEEBADREXFULLENOANOEBADRQCEBADSLTEDEADLOCKEBFONTENOSTRENODATAETIMEENOSRENONETENOPKGEREMOTEENOLINKEADVESRMNTECOMMEPROTOEMULTIHOPEDOTDOTEBADMSGEOVERFLOWENOTUNIQEBADFDEREMCHGELIBACCELIBBADELIBSCNELIBMAXELIBEXECEILSEQERESTARTESTRPIPEEUSERSENOTSOCKEDESTADDRREQEMSGSIZEEPROTOTYPEENOPROTOOPTEPROTONOSUPPORTESOCKTNOSUPPORTEOPNOTSUPPENOTSUPEPFNOSUPPORTEAFNOSUPPORTEADDRINUSEEADDRNOTAVAILENETDOWNENETUNREACHENETRESETECONNABORTEDECONNRESETENOBUFSEISCONNENOTCONNESHUTDOWNETOOMANYREFSETIMEDOUTECONNREFUSEDEHOSTDOWNEHOSTUNREACHEALREADYEINPROGRESSESTALEEUCLEANENOTNAMENAVAILEISNAMEREMOTEIOEDQUOTEQFULLENOTCAPABLEECANCELEDEOWNERDEADENOTRECOVERABLE
ctypes--- A foreign function library for Python- ctypes tutorial
- Loading dynamic link libraries
- Accessing functions from loaded dlls
- Calling functions
- Fundamental data types
- Calling functions, continued
- Calling variadic functions
- Calling functions with your own custom data types
- Specifying the required argument types (function prototypes)
- Return types
- Passing pointers (or: passing parameters by reference)
- Structures and unions
- Structure/union alignment and byte order
- Bit fields in structures and unions
- Arrays
- Pointers
- Type conversions
- Incomplete Types
- Callback functions
- Accessing values exported from dlls
- Surprises
- Variable-sized data types
- ctypes reference
- Finding shared libraries
- Loading shared libraries
- Foreign functions
- Function prototypes
- Utility functions
addressof()alignment()byref()cast()create_string_buffer()create_unicode_buffer()DllCanUnloadNow()DllGetClassObject()find_library()find_msvcrt()FormatError()GetLastError()get_errno()get_last_error()memmove()memset()POINTER()pointer()resize()set_errno()set_last_error()sizeof()string_at()WinError()wstring_at()
- Data types
- Fundamental data types
- Structured data types
- Arrays and pointers
- ctypes tutorial
- 並行執行 (Concurrent Execution)
threading--- Thread-based parallelismactive_count()current_thread()excepthook()__excepthook__get_ident()get_native_id()enumerate()main_thread()settrace()settrace_all_threads()gettrace()setprofile()setprofile_all_threads()getprofile()stack_size()TIMEOUT_MAX- Thread-Local Data
- Thread Objects
- Lock Objects
- RLock 物件
- Condition Objects
- Semaphore Objects
- Event Objects
- Timer Objects
- Barrier Objects
- Using locks, conditions, and semaphores in the
withstatement
multiprocessing--- Process-based parallelism- 簡介
- Reference
Process與例外- Pipes and Queues
- Miscellaneous
- Connection Objects
- Synchronization primitives
- Shared
ctypesObjects - Managers
- Proxy Objects
- Process Pools
- Listeners and Clients
- Authentication keys
- Logging
- The
multiprocessing.dummymodule
- Programming guidelines
- 範例
multiprocessing.shared_memory--- 對於共享記憶體的跨行程直接存取concurrent套件concurrent.futures-- 啟動平行任務subprocess--- Subprocess management- Using the
subprocessModule - Security Considerations
- Popen Objects
- Windows Popen Helpers
STARTUPINFO- Windows Constants
STD_INPUT_HANDLESTD_OUTPUT_HANDLESTD_ERROR_HANDLESW_HIDESTARTF_USESTDHANDLESSTARTF_USESHOWWINDOWCREATE_NEW_CONSOLECREATE_NEW_PROCESS_GROUPABOVE_NORMAL_PRIORITY_CLASSBELOW_NORMAL_PRIORITY_CLASSHIGH_PRIORITY_CLASSIDLE_PRIORITY_CLASSNORMAL_PRIORITY_CLASSREALTIME_PRIORITY_CLASSCREATE_NO_WINDOWDETACHED_PROCESSCREATE_DEFAULT_ERROR_MODECREATE_BREAKAWAY_FROM_JOB
- Older high-level API
- Replacing Older Functions with the
subprocessModule - Legacy Shell Invocation Functions
- 註解
- Using the
sched--- Event schedulerqueue--- 同步佇列 (queue) class(類別)contextvars--- Context Variables_thread--- Low-level threading API
- Networking and Interprocess Communication
asyncio--- 非同步 I/O- Runners (執行器)
- Coroutines and Tasks
- 串流
- 同步化原始物件 (Synchronization Primitives)
- 子行程
- 建立子行程
- 常數
- Interacting with Subprocesses
asyncio.subprocess.Processasyncio.subprocess.Process.wait()asyncio.subprocess.Process.communicate()asyncio.subprocess.Process.send_signal()asyncio.subprocess.Process.terminate()asyncio.subprocess.Process.kill()asyncio.subprocess.Process.stdinasyncio.subprocess.Process.stdoutasyncio.subprocess.Process.stderrasyncio.subprocess.Process.pidasyncio.subprocess.Process.returncode
- 子行程與線程
- 範例
- 佇列 (Queues)
- 例外
- Event Loop
get_running_loop()get_event_loop()set_event_loop()new_event_loop()- Event Loop Methods
- Running and stopping the loop
- Scheduling callbacks
- Scheduling delayed callbacks
- Creating Futures and Tasks
- Opening network connections
- Creating network servers
- Transferring files
- TLS Upgrade
- Watching file descriptors
- Working with socket objects directly
- DNS
- Working with pipes
- Unix signals
- Executing code in thread or process pools
- Error Handling API
- Enabling debug mode
- Running Subprocesses
- Callback Handles
- Server Objects
- Event Loop Implementations
- 範例
- Futures
- Transports and Protocols
- Policies
- Getting and Setting the Policy
- Policy Objects
- Process Watchers
- Custom Policies
- 平臺支援
- Extending
- 高階 API 索引
- 低階 API 索引
- 使用 asyncio 開發
socket--- Low-level networking interface- Socket 系列家族
- 模組內容
- 例外
- 常數
AF_UNIXAF_INETAF_INET6AF_UNSPECSOCK_STREAMSOCK_DGRAMSOCK_RAWSOCK_RDMSOCK_SEQPACKETSOCK_CLOEXECSOCK_NONBLOCKSOMAXCONNAF_CANPF_CANCAN_BCMCAN_RAW_FD_FRAMESCAN_RAW_JOIN_FILTERSCAN_ISOTPCAN_J1939AF_DIVERTPF_DIVERTAF_PACKETPF_PACKETETH_P_ALLAF_RDSPF_RDSSOL_RDSSIO_RCVALLSIO_KEEPALIVE_VALSSIO_LOOPBACK_FAST_PATHAF_ALGSOL_ALGAF_VSOCKIOCTL_VM_SOCKETS_GET_LOCAL_CIDAF_LINKhas_ipv6BDADDR_ANYBDADDR_LOCALHCI_FILTERHCI_TIME_STAMPHCI_DATA_DIRAF_QIPCRTRSCM_CREDS2LOCAL_CREDSLOCAL_CREDS_PERSISTENTSO_INCOMING_CPUAF_HYPERVHV_PROTOCOL_RAWHVSOCKET_CONNECT_TIMEOUTHVSOCKET_CONNECT_TIMEOUT_MAXHVSOCKET_CONNECTED_SUSPENDHVSOCKET_ADDRESS_FLAG_PASSTHRUHV_GUID_ZEROHV_GUID_WILDCARDHV_GUID_BROADCASTHV_GUID_CHILDRENHV_GUID_LOOPBACKHV_GUID_PARENTETHERTYPE_ARPETHERTYPE_IPETHERTYPE_IPV6ETHERTYPE_VLAN
- 函式
- 建立 sockets
- 其他函式
close()getaddrinfo()getfqdn()gethostbyname()gethostbyname_ex()gethostname()gethostbyaddr()getnameinfo()getprotobyname()getservbyname()getservbyport()ntohl()ntohs()htonl()htons()inet_aton()inet_ntoa()inet_pton()inet_ntop()CMSG_LEN()CMSG_SPACE()getdefaulttimeout()setdefaulttimeout()sethostname()if_nameindex()if_nametoindex()if_indextoname()send_fds()recv_fds()
- Socket 物件
socket.accept()socket.bind()socket.close()socket.connect()socket.connect_ex()socket.detach()socket.dup()socket.fileno()socket.get_inheritable()socket.getpeername()socket.getsockname()socket.getsockopt()socket.getblocking()socket.gettimeout()socket.ioctl()socket.listen()socket.makefile()socket.recv()socket.recvfrom()socket.recvmsg()socket.recvmsg_into()socket.recvfrom_into()socket.recv_into()socket.send()socket.sendall()socket.sendto()socket.sendmsg()socket.sendmsg_afalg()socket.sendfile()socket.set_inheritable()socket.setblocking()socket.settimeout()socket.setsockopt()socket.shutdown()socket.share()socket.familysocket.typesocket.proto
- Notes on socket timeouts
- 範例
ssl--- socket 物件的 TLS/SSL 包裝器- 函式、常數與例外
- Socket 建立
- 語境建立
- 例外
- 隨機產生
- 認證處理
- 常數
CERT_NONECERT_OPTIONALCERT_REQUIREDVerifyModeVERIFY_DEFAULTVERIFY_CRL_CHECK_LEAFVERIFY_CRL_CHECK_CHAINVERIFY_X509_STRICTVERIFY_ALLOW_PROXY_CERTSVERIFY_X509_TRUSTED_FIRSTVERIFY_X509_PARTIAL_CHAINVerifyFlagsPROTOCOL_TLSPROTOCOL_TLS_CLIENTPROTOCOL_TLS_SERVERPROTOCOL_SSLv23PROTOCOL_SSLv3PROTOCOL_TLSv1PROTOCOL_TLSv1_1PROTOCOL_TLSv1_2OP_ALLOP_NO_SSLv2OP_NO_SSLv3OP_NO_TLSv1OP_NO_TLSv1_1OP_NO_TLSv1_2OP_NO_TLSv1_3OP_NO_RENEGOTIATIONOP_CIPHER_SERVER_PREFERENCEOP_SINGLE_DH_USEOP_SINGLE_ECDH_USEOP_ENABLE_MIDDLEBOX_COMPATOP_NO_COMPRESSIONOptionsOP_NO_TICKETOP_IGNORE_UNEXPECTED_EOFOP_ENABLE_KTLSOP_LEGACY_SERVER_CONNECTHAS_ALPNHAS_NEVER_CHECK_COMMON_NAMEHAS_ECDHHAS_SNIHAS_NPNHAS_SSLv2HAS_SSLv3HAS_TLSv1HAS_TLSv1_1HAS_TLSv1_2HAS_TLSv1_3CHANNEL_BINDING_TYPESOPENSSL_VERSIONOPENSSL_VERSION_INFOOPENSSL_VERSION_NUMBERALERT_DESCRIPTION_HANDSHAKE_FAILUREALERT_DESCRIPTION_INTERNAL_ERRORAlertDescriptionPurpose.SERVER_AUTHPurpose.CLIENT_AUTHSSLErrorNumberTLSVersion
- SSL Sockets
SSLSocketSSLSocket.read()SSLSocket.write()SSLSocket.do_handshake()SSLSocket.getpeercert()SSLSocket.cipher()SSLSocket.shared_ciphers()SSLSocket.compression()SSLSocket.get_channel_binding()SSLSocket.selected_alpn_protocol()SSLSocket.selected_npn_protocol()SSLSocket.unwrap()SSLSocket.verify_client_post_handshake()SSLSocket.version()SSLSocket.pending()SSLSocket.contextSSLSocket.server_sideSSLSocket.server_hostnameSSLSocket.sessionSSLSocket.session_reused
- SSL Contexts
SSLContextSSLContext.cert_store_stats()SSLContext.load_cert_chain()SSLContext.load_default_certs()SSLContext.load_verify_locations()SSLContext.get_ca_certs()SSLContext.get_ciphers()SSLContext.set_default_verify_paths()SSLContext.set_ciphers()SSLContext.set_alpn_protocols()SSLContext.set_npn_protocols()SSLContext.sni_callbackSSLContext.set_servername_callbackSSLContext.load_dh_params()SSLContext.set_ecdh_curve()SSLContext.wrap_socket()SSLContext.sslsocket_classSSLContext.wrap_bio()SSLContext.sslobject_classSSLContext.session_stats()SSLContext.check_hostnameSSLContext.keylog_filenameSSLContext.maximum_versionSSLContext.minimum_versionSSLContext.num_ticketsSSLContext.optionsSSLContext.post_handshake_authSSLContext.protocolSSLContext.hostname_checks_common_nameSSLContext.security_levelSSLContext.verify_flagsSSLContext.verify_mode
- Certificates
- 範例
- Notes on non-blocking sockets
- Memory BIO Support
- SSL session
- Security considerations
- TLS 1.3
- 函式、常數與例外
select--- Waiting for I/O completionselectors--- High-level I/O multiplexingsignal--- Set handlers for asynchronous events- General rules
- 模組內容
SignalsHandlersSigmasksSIG_DFLSIG_IGNSIGABRTSIGALRMSIGBREAKSIGBUSSIGCHLDSIGCLDSIGCONTSIGFPESIGHUPSIGILLSIGINTSIGKILLSIGPIPESIGSEGVSIGSTKFLTSIGTERMSIGUSR1SIGUSR2SIGWINCHCTRL_C_EVENTCTRL_BREAK_EVENTNSIGITIMER_REALITIMER_VIRTUALITIMER_PROFSIG_BLOCKSIG_UNBLOCKSIG_SETMASKItimerErroralarm()getsignal()strsignal()valid_signals()pause()raise_signal()pidfd_send_signal()pthread_kill()pthread_sigmask()setitimer()getitimer()set_wakeup_fd()siginterrupt()signal()sigpending()sigwait()sigwaitinfo()sigtimedwait()
- 範例
- Note on SIGPIPE
- Note on Signal Handlers and Exceptions
mmap--- Memory-mapped file supportmmap- MADV_* Constants
MADV_NORMALMADV_RANDOMMADV_SEQUENTIALMADV_WILLNEEDMADV_DONTNEEDMADV_REMOVEMADV_DONTFORKMADV_DOFORKMADV_HWPOISONMADV_MERGEABLEMADV_UNMERGEABLEMADV_SOFT_OFFLINEMADV_HUGEPAGEMADV_NOHUGEPAGEMADV_DONTDUMPMADV_DODUMPMADV_FREEMADV_NOSYNCMADV_AUTOSYNCMADV_NOCOREMADV_COREMADV_PROTECTMADV_FREE_REUSABLEMADV_FREE_REUSE
- MAP_* 常數
- 網際網路資料處理
email--- An email and MIME handling packageemail.message: Representing an email messageEmailMessageEmailMessage.as_string()EmailMessage.__str__()EmailMessage.as_bytes()EmailMessage.__bytes__()EmailMessage.is_multipart()EmailMessage.set_unixfrom()EmailMessage.get_unixfrom()EmailMessage.__len__()EmailMessage.__contains__()EmailMessage.__getitem__()EmailMessage.__setitem__()EmailMessage.__delitem__()EmailMessage.keys()EmailMessage.values()EmailMessage.items()EmailMessage.get()EmailMessage.get_all()EmailMessage.add_header()EmailMessage.replace_header()EmailMessage.get_content_type()EmailMessage.get_content_maintype()EmailMessage.get_content_subtype()EmailMessage.get_default_type()EmailMessage.set_default_type()EmailMessage.set_param()EmailMessage.del_param()EmailMessage.get_filename()EmailMessage.get_boundary()EmailMessage.set_boundary()EmailMessage.get_content_charset()EmailMessage.get_charsets()EmailMessage.is_attachment()EmailMessage.get_content_disposition()EmailMessage.walk()EmailMessage.get_body()EmailMessage.iter_attachments()EmailMessage.iter_parts()EmailMessage.get_content()EmailMessage.set_content()EmailMessage.make_related()EmailMessage.make_alternative()EmailMessage.make_mixed()EmailMessage.add_related()EmailMessage.add_alternative()EmailMessage.add_attachment()EmailMessage.clear()EmailMessage.clear_content()EmailMessage.preambleEmailMessage.epilogueEmailMessage.defects
MIMEPart
email.parser: Parsing email messagesemail.generator: Generating MIME documentsemail.policy: Policy ObjectsPolicyPolicy.max_line_lengthPolicy.linesepPolicy.cte_typePolicy.raise_on_defectPolicy.mangle_from_Policy.message_factoryPolicy.clone()Policy.handle_defect()Policy.register_defect()Policy.header_max_count()Policy.header_source_parse()Policy.header_store_parse()Policy.header_fetch_parse()Policy.fold()Policy.fold_binary()
EmailPolicydefaultSMTPSMTPUTF8HTTPstrictCompat32compat32
email.errors: Exception and Defect classesemail.headerregistry: Custom Header Objectsemail.contentmanager: Managing MIME Contentemail: Examplesemail.message.Message: Representing an email message using thecompat32APIMessageMessage.as_string()Message.__str__()Message.as_bytes()Message.__bytes__()Message.is_multipart()Message.set_unixfrom()Message.get_unixfrom()Message.attach()Message.get_payload()Message.set_payload()Message.set_charset()Message.get_charset()Message.__len__()Message.__contains__()Message.__getitem__()Message.__setitem__()Message.__delitem__()Message.keys()Message.values()Message.items()Message.get()Message.get_all()Message.add_header()Message.replace_header()Message.get_content_type()Message.get_content_maintype()Message.get_content_subtype()Message.get_default_type()Message.set_default_type()Message.get_params()Message.get_param()Message.set_param()Message.del_param()Message.set_type()Message.get_filename()Message.get_boundary()Message.set_boundary()Message.get_content_charset()Message.get_charsets()Message.get_content_disposition()Message.walk()Message.preambleMessage.epilogueMessage.defects
email.mime: Creating email and MIME objects from scratchemail.header: Internationalized headersemail.charset: 表示字元集合CharsetCharset.input_charsetCharset.header_encodingCharset.body_encodingCharset.output_charsetCharset.input_codecCharset.output_codecCharset.get_body_encoding()Charset.get_output_charset()Charset.header_encode()Charset.header_encode_lines()Charset.body_encode()Charset.__str__()Charset.__eq__()Charset.__ne__()
add_charset()add_alias()add_codec()
email.encoders: Encodersemail.utils: Miscellaneous utilitiesemail.iterators: Iterators
json--- JSON 編碼器與解碼器mailbox--- 以各種格式操作郵件信箱Mailbox物件MailboxMailbox.add()Mailbox.remove()Mailbox.__delitem__()Mailbox.discard()Mailbox.__setitem__()Mailbox.iterkeys()Mailbox.keys()Mailbox.itervalues()Mailbox.__iter__()Mailbox.values()Mailbox.iteritems()Mailbox.items()Mailbox.get()Mailbox.__getitem__()Mailbox.get_message()Mailbox.get_bytes()Mailbox.get_string()Mailbox.get_file()Mailbox.__contains__()Mailbox.__len__()Mailbox.clear()Mailbox.pop()Mailbox.popitem()Mailbox.update()Mailbox.flush()Mailbox.lock()Mailbox.unlock()Mailbox.close()
Mailbox物件mbox物件MH物件Babyl物件MMDF物件
Message物件- 例外
- 範例
mimetypes--- Map filenames to MIME typesbase64—— Base16、Base32、Base64、Base85 資料編碼b64encode()b64decode()standard_b64encode()standard_b64decode()urlsafe_b64encode()urlsafe_b64decode()b32encode()b32decode()b32hexencode()b32hexdecode()b16encode()b16decode()a85encode()a85decode()b85encode()b85decode()decode()decodebytes()encode()encodebytes()- Security Considerations
binascii--- Convert between binary and ASCIIquopri--- 編碼和解碼 MIME 可列印字元資料
- Structured Markup Processing Tools
html--- 超連結標記語言 (HTML) 支援html.parser--- 簡單的 HTML 和 XHTML 剖析器HTMLParser- HTML 剖析器應用程式範例
HTMLParser方法HTMLParser.feed()HTMLParser.close()HTMLParser.reset()HTMLParser.getpos()HTMLParser.get_starttag_text()HTMLParser.handle_starttag()HTMLParser.handle_endtag()HTMLParser.handle_startendtag()HTMLParser.handle_data()HTMLParser.handle_entityref()HTMLParser.handle_charref()HTMLParser.handle_comment()HTMLParser.handle_decl()HTMLParser.handle_pi()HTMLParser.unknown_decl()
- 範例
html.entities--- HTML 一般實體的定義- XML 處理模組
xml.etree.ElementTree--- The ElementTree XML API- 教學
- XPath 支援
- Reference
- XInclude support
- Reference
- 函式
- Element Objects
ElementElement.tagElement.textElement.tailElement.attribElement.clear()Element.get()Element.items()Element.keys()Element.set()Element.append()Element.extend()Element.find()Element.findall()Element.findtext()Element.insert()Element.iter()Element.iterfind()Element.itertext()Element.makeelement()Element.remove()
- ElementTree 物件
- QName 物件
- TreeBuilder 物件
- XMLParser 物件
- XMLPullParser 物件
- 例外
xml.dom--- The Document Object Model API- 模組內容
- Objects in the DOM
- DOMImplementation 物件
- Node Objects
Node.nodeTypeNode.parentNodeNode.attributesNode.previousSiblingNode.nextSiblingNode.childNodesNode.firstChildNode.lastChildNode.localNameNode.prefixNode.namespaceURINode.nodeNameNode.nodeValueNode.hasAttributes()Node.hasChildNodes()Node.isSameNode()Node.appendChild()Node.insertBefore()Node.removeChild()Node.replaceChild()Node.normalize()Node.cloneNode()
- NodeList 物件
- DocumentType 物件
- Document Objects
- Element Objects
Element.tagNameElement.getElementsByTagName()Element.getElementsByTagNameNS()Element.hasAttribute()Element.hasAttributeNS()Element.getAttribute()Element.getAttributeNode()Element.getAttributeNS()Element.getAttributeNodeNS()Element.removeAttribute()Element.removeAttributeNode()Element.removeAttributeNS()Element.setAttribute()Element.setAttributeNode()Element.setAttributeNodeNS()Element.setAttributeNS()
- Attr Objects
- NamedNodeMap 物件
- Comment Objects
- Text and CDATASection Objects
- ProcessingInstruction 物件
- 例外
- Conformance
xml.dom.minidom--- Minimal DOM implementationxml.dom.pulldom--- Support for building partial DOM treesxml.sax--- Support for SAX2 parsersxml.sax.handler--- Base classes for SAX handlersContentHandlerDTDHandlerEntityResolverErrorHandlerLexicalHandlerfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pesall_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringall_properties- ContentHandler 物件
ContentHandler.setDocumentLocator()ContentHandler.startDocument()ContentHandler.endDocument()ContentHandler.startPrefixMapping()ContentHandler.endPrefixMapping()ContentHandler.startElement()ContentHandler.endElement()ContentHandler.startElementNS()ContentHandler.endElementNS()ContentHandler.characters()ContentHandler.ignorableWhitespace()ContentHandler.processingInstruction()ContentHandler.skippedEntity()
- DTDHandler 物件
- EntityResolver 物件
- ErrorHandler 物件
- LexicalHandler 物件
xml.sax.saxutils--- SAX Utilitiesxml.sax.xmlreader--- Interface for XML parsersXMLReaderIncrementalParserLocatorInputSourceAttributesImplAttributesNSImpl- XMLReader 物件
XMLReader.parse()XMLReader.getContentHandler()XMLReader.setContentHandler()XMLReader.getDTDHandler()XMLReader.setDTDHandler()XMLReader.getEntityResolver()XMLReader.setEntityResolver()XMLReader.getErrorHandler()XMLReader.setErrorHandler()XMLReader.setLocale()XMLReader.getFeature()XMLReader.setFeature()XMLReader.getProperty()XMLReader.setProperty()
- IncrementalParser 物件
- Locator Objects
- InputSource 物件
- The
AttributesInterface - The
AttributesNSInterface
xml.parsers.expat--- Fast XML parsing using ExpatExpatErrorerrorXMLParserTypeErrorString()ParserCreate()- XMLParser 物件
xmlparser.Parse()xmlparser.ParseFile()xmlparser.SetBase()xmlparser.GetBase()xmlparser.GetInputContext()xmlparser.ExternalEntityParserCreate()xmlparser.SetParamEntityParsing()xmlparser.UseForeignDTD()xmlparser.buffer_sizexmlparser.buffer_textxmlparser.buffer_usedxmlparser.ordered_attributesxmlparser.specified_attributesxmlparser.ErrorByteIndexxmlparser.ErrorCodexmlparser.ErrorColumnNumberxmlparser.ErrorLineNumberxmlparser.CurrentByteIndexxmlparser.CurrentColumnNumberxmlparser.CurrentLineNumberxmlparser.XmlDeclHandler()xmlparser.StartDoctypeDeclHandler()xmlparser.EndDoctypeDeclHandler()xmlparser.ElementDeclHandler()xmlparser.AttlistDeclHandler()xmlparser.StartElementHandler()xmlparser.EndElementHandler()xmlparser.ProcessingInstructionHandler()xmlparser.CharacterDataHandler()xmlparser.UnparsedEntityDeclHandler()xmlparser.EntityDeclHandler()xmlparser.NotationDeclHandler()xmlparser.StartNamespaceDeclHandler()xmlparser.EndNamespaceDeclHandler()xmlparser.CommentHandler()xmlparser.StartCdataSectionHandler()xmlparser.EndCdataSectionHandler()xmlparser.DefaultHandler()xmlparser.DefaultHandlerExpand()xmlparser.NotStandaloneHandler()xmlparser.ExternalEntityRefHandler()
- ExpatError 例外
- 範例
- Content Model Descriptions
- Expat error constants
codesmessagesXML_ERROR_ASYNC_ENTITYXML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REFXML_ERROR_BAD_CHAR_REFXML_ERROR_BINARY_ENTITY_REFXML_ERROR_DUPLICATE_ATTRIBUTEXML_ERROR_INCORRECT_ENCODINGXML_ERROR_INVALID_TOKENXML_ERROR_JUNK_AFTER_DOC_ELEMENTXML_ERROR_MISPLACED_XML_PIXML_ERROR_NO_ELEMENTSXML_ERROR_NO_MEMORYXML_ERROR_PARAM_ENTITY_REFXML_ERROR_PARTIAL_CHARXML_ERROR_RECURSIVE_ENTITY_REFXML_ERROR_SYNTAXXML_ERROR_TAG_MISMATCHXML_ERROR_UNCLOSED_TOKENXML_ERROR_UNDEFINED_ENTITYXML_ERROR_UNKNOWN_ENCODINGXML_ERROR_UNCLOSED_CDATA_SECTIONXML_ERROR_EXTERNAL_ENTITY_HANDLINGXML_ERROR_NOT_STANDALONEXML_ERROR_UNEXPECTED_STATEXML_ERROR_ENTITY_DECLARED_IN_PEXML_ERROR_FEATURE_REQUIRES_XML_DTDXML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSINGXML_ERROR_UNBOUND_PREFIXXML_ERROR_UNDECLARING_PREFIXXML_ERROR_INCOMPLETE_PEXML_ERROR_XML_DECLXML_ERROR_TEXT_DECLXML_ERROR_PUBLICIDXML_ERROR_SUSPENDEDXML_ERROR_NOT_SUSPENDEDXML_ERROR_ABORTEDXML_ERROR_FINISHEDXML_ERROR_SUSPEND_PEXML_ERROR_RESERVED_PREFIX_XMLXML_ERROR_RESERVED_PREFIX_XMLNSXML_ERROR_RESERVED_NAMESPACE_URIXML_ERROR_INVALID_ARGUMENTXML_ERROR_NO_BUFFERXML_ERROR_AMPLIFICATION_LIMIT_BREACH
- 網路協定 (Internet protocols) 及支援
webbrowser--- Convenient web-browser controllerwsgiref--- WSGI 工具與參考實作wsgiref.util-- WSGI 環境工具wsgiref.headers-- WSGI 回應標頭工具wsgiref.simple_server-- 一個簡單的 WSGI HTTP 伺服器wsgiref.validate--- WSGI 符合性檢查wsgiref.handlers-- 伺服器 / 閘道基本類別CGIHandlerIISCGIHandlerBaseCGIHandlerSimpleHandlerBaseHandlerBaseHandler.run()BaseHandler._write()BaseHandler._flush()BaseHandler.get_stdin()BaseHandler.get_stderr()BaseHandler.add_cgi_vars()BaseHandler.wsgi_multithreadBaseHandler.wsgi_multiprocessBaseHandler.wsgi_run_onceBaseHandler.os_environBaseHandler.server_softwareBaseHandler.get_scheme()BaseHandler.setup_environ()BaseHandler.log_exception()BaseHandler.traceback_limitBaseHandler.error_output()BaseHandler.error_statusBaseHandler.error_headersBaseHandler.error_bodyBaseHandler.wsgi_file_wrapperBaseHandler.sendfile()BaseHandler.origin_serverBaseHandler.http_version
read_environ()
wsgiref.types-- 用於靜態型別檢查的 WSGI 型別- 範例
urllib--- URL 處理模組urllib.request--- 用來開啟 URLs 的可擴充函式庫urlopen()install_opener()build_opener()pathname2url()url2pathname()getproxies()RequestOpenerDirectorBaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessorProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmHTTPPasswordMgrWithPriorAuthAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandlerHTTPHandlerHTTPSHandlerFileHandlerDataHandlerFTPHandlerCacheFTPHandlerUnknownHandlerHTTPErrorProcessor- Request Objects
Request.full_urlRequest.typeRequest.hostRequest.origin_req_hostRequest.selectorRequest.dataRequest.unverifiableRequest.methodRequest.get_method()Request.add_header()Request.add_unredirected_header()Request.has_header()Request.remove_header()Request.get_full_url()Request.set_proxy()Request.get_header()Request.header_items()
- OpenerDirector 物件
- BaseHandler 物件
- HTTPRedirectHandler 物件
- HTTPCookieProcessor 物件
- ProxyHandler 物件
- HTTPPasswordMgr 物件
- HTTPPasswordMgrWithPriorAuth 物件
- AbstractBasicAuthHandler 物件
- HTTPBasicAuthHandler 物件
- ProxyBasicAuthHandler 物件
- AbstractDigestAuthHandler 物件
- HTTPDigestAuthHandler 物件
- ProxyDigestAuthHandler 物件
- HTTPHandler 物件
- HTTPSHandler 物件
- FileHandler 物件
- DataHandler 物件
- FTPHandler 物件
- CacheFTPHandler 物件
- UnknownHandler 物件
- HTTPErrorProcessor 物件
- Examples
- Legacy interface
urllib.requestRestrictions
urllib.response--- Response classes used by urlliburllib.parse--- Parse URLs into componentsurllib.error--- urllib.request 引發的例外類別urllib.robotparser--- robots.txt 的剖析器http--- HTTP 模組http.client--- HTTP protocol clientHTTPConnectionHTTPSConnectionHTTPResponseparse_headers()HTTPExceptionNotConnectedInvalidURLUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteReadImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReadyBadStatusLineLineTooLongRemoteDisconnectedHTTP_PORTHTTPS_PORTresponses- HTTPConnection 物件
HTTPConnection.request()HTTPConnection.getresponse()HTTPConnection.set_debuglevel()HTTPConnection.set_tunnel()HTTPConnection.get_proxy_response_headers()HTTPConnection.connect()HTTPConnection.close()HTTPConnection.blocksizeHTTPConnection.putrequest()HTTPConnection.putheader()HTTPConnection.endheaders()HTTPConnection.send()
- HTTPResponse 物件
HTTPResponse.read()HTTPResponse.readinto()HTTPResponse.getheader()HTTPResponse.getheaders()HTTPResponse.fileno()HTTPResponse.msgHTTPResponse.versionHTTPResponse.urlHTTPResponse.headersHTTPResponse.statusHTTPResponse.reasonHTTPResponse.debuglevelHTTPResponse.closedHTTPResponse.geturl()HTTPResponse.info()HTTPResponse.getcode()
- 範例
- HTTPMessage 物件
ftplib--- FTP 協定用戶端FTPerror_replyerror_temperror_permerror_protoall_errors- FTP 物件
FTP.set_debuglevel()FTP.connect()FTP.getwelcome()FTP.login()FTP.abort()FTP.sendcmd()FTP.voidcmd()FTP.retrbinary()FTP.retrlines()FTP.set_pasv()FTP.storbinary()FTP.storlines()FTP.transfercmd()FTP.ntransfercmd()FTP.mlsd()FTP.nlst()FTP.dir()FTP.rename()FTP.delete()FTP.cwd()FTP.mkd()FTP.pwd()FTP.rmd()FTP.size()FTP.quit()FTP.close()
- FTP_TLS 物件
poplib--- POP3 protocol clientimaplib--- IMAP4 protocol clientIMAP4IMAP4_SSLIMAP4_streamInternaldate2tuple()Int2AP()ParseFlags()Time2Internaldate()- IMAP4 物件
IMAP4.append()IMAP4.authenticate()IMAP4.check()IMAP4.close()IMAP4.copy()IMAP4.create()IMAP4.delete()IMAP4.deleteacl()IMAP4.enable()IMAP4.expunge()IMAP4.fetch()IMAP4.getacl()IMAP4.getannotation()IMAP4.getquota()IMAP4.getquotaroot()IMAP4.list()IMAP4.login()IMAP4.login_cram_md5()IMAP4.logout()IMAP4.lsub()IMAP4.myrights()IMAP4.namespace()IMAP4.noop()IMAP4.open()IMAP4.partial()IMAP4.proxyauth()IMAP4.read()IMAP4.readline()IMAP4.recent()IMAP4.rename()IMAP4.response()IMAP4.search()IMAP4.select()IMAP4.send()IMAP4.setacl()IMAP4.setannotation()IMAP4.setquota()IMAP4.shutdown()IMAP4.socket()IMAP4.sort()IMAP4.starttls()IMAP4.status()IMAP4.store()IMAP4.subscribe()IMAP4.thread()IMAP4.uid()IMAP4.unsubscribe()IMAP4.unselect()IMAP4.xatom()IMAP4.PROTOCOL_VERSIONIMAP4.debugIMAP4.utf8_enabled
- IMAP4 範例
smtplib--- SMTP protocol clientuuid--- RFC 4122 定義的 UUID 物件socketserver--- A framework for network serversTCPServerUDPServerUnixStreamServerUnixDatagramServer- Server Creation Notes
- Server Objects
BaseServerBaseServer.fileno()BaseServer.handle_request()BaseServer.serve_forever()BaseServer.service_actions()BaseServer.shutdown()BaseServer.server_close()BaseServer.address_familyBaseServer.RequestHandlerClassBaseServer.server_addressBaseServer.socketBaseServer.allow_reuse_addressBaseServer.request_queue_sizeBaseServer.socket_typeBaseServer.timeoutBaseServer.finish_request()BaseServer.get_request()BaseServer.handle_error()BaseServer.handle_timeout()BaseServer.process_request()BaseServer.server_activate()BaseServer.server_bind()BaseServer.verify_request()
- Request Handler Objects
- 範例
http.server--- HTTP serversHTTPServerThreadingHTTPServerBaseHTTPRequestHandlerBaseHTTPRequestHandler.client_addressBaseHTTPRequestHandler.serverBaseHTTPRequestHandler.close_connectionBaseHTTPRequestHandler.requestlineBaseHTTPRequestHandler.commandBaseHTTPRequestHandler.pathBaseHTTPRequestHandler.request_versionBaseHTTPRequestHandler.headersBaseHTTPRequestHandler.rfileBaseHTTPRequestHandler.wfileBaseHTTPRequestHandler.server_versionBaseHTTPRequestHandler.sys_versionBaseHTTPRequestHandler.error_message_formatBaseHTTPRequestHandler.error_content_typeBaseHTTPRequestHandler.protocol_versionBaseHTTPRequestHandler.MessageClassBaseHTTPRequestHandler.responsesBaseHTTPRequestHandler.handle()BaseHTTPRequestHandler.handle_one_request()BaseHTTPRequestHandler.handle_expect_100()BaseHTTPRequestHandler.send_error()BaseHTTPRequestHandler.send_response()BaseHTTPRequestHandler.send_header()BaseHTTPRequestHandler.send_response_only()BaseHTTPRequestHandler.end_headers()BaseHTTPRequestHandler.flush_headers()BaseHTTPRequestHandler.log_request()BaseHTTPRequestHandler.log_error()BaseHTTPRequestHandler.log_message()BaseHTTPRequestHandler.version_string()BaseHTTPRequestHandler.date_time_string()BaseHTTPRequestHandler.log_date_time_string()BaseHTTPRequestHandler.address_string()
SimpleHTTPRequestHandlerCGIHTTPRequestHandler- Security Considerations
http.cookies--- HTTP state managementCookieErrorBaseCookieSimpleCookie- Cookie 物件
- Morsel 物件
MorselMorsel.expiresMorsel.pathMorsel.commentMorsel.domainMorsel.secureMorsel.versionMorsel.httponlyMorsel.samesiteMorsel.valueMorsel.coded_valueMorsel.keyMorsel.set()Morsel.isReservedKey()Morsel.output()Morsel.js_output()Morsel.OutputString()Morsel.update()Morsel.copy()Morsel.setdefault()
- 範例
http.cookiejar--- Cookie handling for HTTP clientsLoadErrorCookieJarFileCookieJarCookiePolicyDefaultCookiePolicyCookie- CookieJar 與 FileCookieJar 物件
CookieJar.add_cookie_header()CookieJar.extract_cookies()CookieJar.set_policy()CookieJar.make_cookies()CookieJar.set_cookie_if_ok()CookieJar.set_cookie()CookieJar.clear()CookieJar.clear_session_cookies()FileCookieJar.save()FileCookieJar.load()FileCookieJar.revert()FileCookieJar.filenameFileCookieJar.delayload
- FileCookieJar subclasses and co-operation with web browsers
- CookiePolicy 物件
- DefaultCookiePolicy 物件
DefaultCookiePolicy.blocked_domains()DefaultCookiePolicy.set_blocked_domains()DefaultCookiePolicy.is_blocked()DefaultCookiePolicy.allowed_domains()DefaultCookiePolicy.set_allowed_domains()DefaultCookiePolicy.is_not_allowed()DefaultCookiePolicy.rfc2109_as_netscapeDefaultCookiePolicy.strict_domainDefaultCookiePolicy.strict_rfc2965_unverifiableDefaultCookiePolicy.strict_ns_unverifiableDefaultCookiePolicy.strict_ns_domainDefaultCookiePolicy.strict_ns_set_initial_dollarDefaultCookiePolicy.strict_ns_set_pathDefaultCookiePolicy.DomainStrictNoDotsDefaultCookiePolicy.DomainStrictNonDomainDefaultCookiePolicy.DomainRFC2965MatchDefaultCookiePolicy.DomainLiberalDefaultCookiePolicy.DomainStrict
- Cookie 物件
Cookie.versionCookie.nameCookie.valueCookie.portCookie.pathCookie.secureCookie.expiresCookie.discardCookie.commentCookie.comment_urlCookie.rfc2109Cookie.port_specifiedCookie.domain_specifiedCookie.domain_initial_dotCookie.has_nonstandard_attr()Cookie.get_nonstandard_attr()Cookie.set_nonstandard_attr()Cookie.is_expired()
- 範例
xmlrpc--- XMLRPC 伺服器與用戶模組xmlrpc.client--- XML-RPC client accessxmlrpc.server--- Basic XML-RPC serversipaddress--- IPv4/IPv6 manipulation library- Convenience factory functions
- IP Addresses
- Address objects
IPv4AddressIPv4Address.versionIPv4Address.max_prefixlenIPv4Address.compressedIPv4Address.explodedIPv4Address.packedIPv4Address.reverse_pointerIPv4Address.is_multicastIPv4Address.is_privateIPv4Address.is_globalIPv4Address.is_unspecifiedIPv4Address.is_reservedIPv4Address.is_loopbackIPv4Address.is_link_localIPv4Address.__format__()
IPv6AddressIPv6Address.compressedIPv6Address.explodedIPv6Address.packedIPv6Address.reverse_pointerIPv6Address.versionIPv6Address.max_prefixlenIPv6Address.is_multicastIPv6Address.is_privateIPv6Address.is_globalIPv6Address.is_unspecifiedIPv6Address.is_reservedIPv6Address.is_loopbackIPv6Address.is_link_localIPv6Address.is_site_localIPv6Address.ipv4_mappedIPv6Address.scope_idIPv6Address.sixtofourIPv6Address.teredoIPv6Address.__format__()
- Conversion to Strings and Integers
- Operators
- Address objects
- IP Network definitions
- Prefix, net mask and host mask
- Network objects
IPv4NetworkIPv4Network.versionIPv4Network.max_prefixlenIPv4Network.is_multicastIPv4Network.is_privateIPv4Network.is_unspecifiedIPv4Network.is_reservedIPv4Network.is_loopbackIPv4Network.is_link_localIPv4Network.network_addressIPv4Network.broadcast_addressIPv4Network.hostmaskIPv4Network.netmaskIPv4Network.with_prefixlenIPv4Network.compressedIPv4Network.explodedIPv4Network.with_netmaskIPv4Network.with_hostmaskIPv4Network.num_addressesIPv4Network.prefixlenIPv4Network.hosts()IPv4Network.overlaps()IPv4Network.address_exclude()IPv4Network.subnets()IPv4Network.supernet()IPv4Network.subnet_of()IPv4Network.supernet_of()IPv4Network.compare_networks()
IPv6NetworkIPv6Network.versionIPv6Network.max_prefixlenIPv6Network.is_multicastIPv6Network.is_privateIPv6Network.is_unspecifiedIPv6Network.is_reservedIPv6Network.is_loopbackIPv6Network.is_link_localIPv6Network.network_addressIPv6Network.broadcast_addressIPv6Network.hostmaskIPv6Network.netmaskIPv6Network.with_prefixlenIPv6Network.compressedIPv6Network.explodedIPv6Network.with_netmaskIPv6Network.with_hostmaskIPv6Network.num_addressesIPv6Network.prefixlenIPv6Network.hosts()IPv6Network.overlaps()IPv6Network.address_exclude()IPv6Network.subnets()IPv6Network.supernet()IPv6Network.subnet_of()IPv6Network.supernet_of()IPv6Network.compare_networks()IPv6Network.is_site_local
- Operators
- Interface objects
- Other Module Level Functions
- Custom Exceptions
- 多媒體服務
wave--- 讀寫 WAV 檔案open()Error- Wave_read 物件
Wave_readWave_read.close()Wave_read.getnchannels()Wave_read.getsampwidth()Wave_read.getframerate()Wave_read.getnframes()Wave_read.getcomptype()Wave_read.getcompname()Wave_read.getparams()Wave_read.readframes()Wave_read.rewind()Wave_read.getmarkers()Wave_read.getmark()Wave_read.setpos()Wave_read.tell()
- Wave_write 物件
colorsys--- 顏色系統間的轉換
- 國際化
gettext--- Multilingual internationalization serviceslocale--- Internationalization servicesErrorsetlocale()localeconv()nl_langinfo()CODESETD_T_FMTD_FMTT_FMTT_FMT_AMPMRADIXCHARTHOUSEPYESEXPRNOEXPRCRNCYSTRERAERA_D_T_FMTERA_D_FMTERA_T_FMTALT_DIGITSgetdefaultlocale()getlocale()getpreferredencoding()getencoding()normalize()resetlocale()strcoll()strxfrm()format_string()currency()str()delocalize()localize()atof()atoi()LC_CTYPELC_COLLATELC_TIMELC_MONETARYLC_MESSAGESLC_NUMERICLC_ALLCHAR_MAX- Background, details, hints, tips and caveats
- For extension writers and programs that embed Python
- Access to message catalogs
- 程式框架
turtle--- 龜圖學 (Turtle graphics)- 介紹
- 教學
- How to...
- Turtle graphics reference
- Methods of RawTurtle/Turtle and corresponding functions
- Methods of TurtleScreen/Screen and corresponding functions
- Public classes
- Explanation
- Help and configuration
turtledemo--- Demo scripts- Changes since Python 2.6
- Changes since Python 3.0
cmd--- Support for line-oriented command interpretersCmd- Cmd 物件
Cmd.cmdloop()Cmd.do_help()Cmd.onecmd()Cmd.emptyline()Cmd.default()Cmd.completedefault()Cmd.columnize()Cmd.precmd()Cmd.postcmd()Cmd.preloop()Cmd.postloop()Cmd.promptCmd.identcharsCmd.lastcmdCmd.cmdqueueCmd.introCmd.doc_headerCmd.misc_headerCmd.undoc_headerCmd.rulerCmd.use_rawinput
- Cmd Example
shlex--- Simple lexical analysissplit()join()quote()shlex- shlex 物件
shlex.get_token()shlex.push_token()shlex.read_token()shlex.sourcehook()shlex.push_source()shlex.pop_source()shlex.error_leader()shlex.commentersshlex.wordcharsshlex.whitespaceshlex.escapeshlex.quotesshlex.escapedquotesshlex.whitespace_splitshlex.infileshlex.instreamshlex.sourceshlex.debugshlex.linenoshlex.tokenshlex.eofshlex.punctuation_chars
- Parsing Rules
- Improved Compatibility with Shells
- 以 Tk 打造圖形使用者介面 (Graphical User Interfaces)
tkinter--- Python interface to Tcl/Tktkinter.colorchooser--- Color choosing dialogtkinter.font--- Tkinter font wrapper- Tkinter Dialogs
tkinter.simpledialog--- Standard Tkinter input dialogstkinter.filedialog--- File selection dialogs- Native Load/Save Dialogs
askopenfile()askopenfiles()asksaveasfile()askopenfilename()askopenfilenames()asksaveasfilename()askdirectory()OpenSaveAsDirectoryFileDialogFileDialog.cancel_command()FileDialog.dirs_double_event()FileDialog.dirs_select_event()FileDialog.files_double_event()FileDialog.files_select_event()FileDialog.filter_command()FileDialog.get_filter()FileDialog.get_selection()FileDialog.go()FileDialog.ok_event()FileDialog.quit()FileDialog.set_filter()FileDialog.set_selection()
LoadFileDialogSaveFileDialog
- Native Load/Save Dialogs
tkinter.commondialog--- Dialog window templates
tkinter.messagebox--- Tkinter message promptstkinter.scrolledtext--- Scrolled Text Widgettkinter.dnd--- Drag and drop supporttkinter.ttk--- Tk themed widgets- Using Ttk
- Ttk Widgets
- Widget
- Combobox
- Spinbox
- Notebook
- Progressbar
- Separator
- Sizegrip
- Treeview
- 選項
- Item Options
- Tag Options
- Column Identifiers
- 虛擬事件
- ttk.Treeview
TreeviewTreeview.bbox()Treeview.get_children()Treeview.set_children()Treeview.column()Treeview.delete()Treeview.detach()Treeview.exists()Treeview.focus()Treeview.heading()Treeview.identify()Treeview.identify_row()Treeview.identify_column()Treeview.identify_region()Treeview.identify_element()Treeview.index()Treeview.insert()Treeview.item()Treeview.move()Treeview.next()Treeview.parent()Treeview.prev()Treeview.reattach()Treeview.see()Treeview.selection()Treeview.selection_set()Treeview.selection_add()Treeview.selection_remove()Treeview.selection_toggle()Treeview.set()Treeview.tag_bind()Treeview.tag_configure()Treeview.tag_has()Treeview.xview()Treeview.yview()
- Ttk Styling
tkinter.tix--- Tk 擴充小工具- IDLE
- 開發工具
typing--- 支援型別提示- 相關的 PEPs
- 型別別名
- NewType
- 註釋 callable 物件
- 泛型
- 註釋元組 (tuple)
- The type of class objects
- User-defined generic types
Any型別- Nominal vs structural subtyping
- 模組內容
- Special typing primitives
- 協定
- ABCs for working with IO
- 函式與裝飾器
- Introspection helpers
- 常數
- 棄用的別名
- Deprecation Timeline of Major Features
pydoc--- Documentation generator and online help system- Python Development Mode
doctest--- Test interactive Python examples- Simple Usage: Checking Examples in Docstrings
- Simple Usage: Checking Examples in a Text File
- How It Works
- Basic API
- Unittest API
- Advanced API
- Debugging
- Soapbox
unittest--- 單元測試框架- 簡單範例
- 命令執行列介面 (Command-Line Interface)
- Test Discovery(測試探索)
- Organizing test code
- Re-using old test code
- Skipping tests and expected failures
- Distinguishing test iterations using subtests
- Classes and functions
- Test cases
TestCaseTestCase.setUp()TestCase.tearDown()TestCase.setUpClass()TestCase.tearDownClass()TestCase.run()TestCase.skipTest()TestCase.subTest()TestCase.debug()TestCase.assertEqual()TestCase.assertNotEqual()TestCase.assertTrue()TestCase.assertFalse()TestCase.assertIs()TestCase.assertIsNot()TestCase.assertIsNone()TestCase.assertIsNotNone()TestCase.assertIn()TestCase.assertNotIn()TestCase.assertIsInstance()TestCase.assertNotIsInstance()TestCase.assertRaises()TestCase.assertRaisesRegex()TestCase.assertWarns()TestCase.assertWarnsRegex()TestCase.assertLogs()TestCase.recordsTestCase.outputTestCase.assertNoLogs()TestCase.assertAlmostEqual()TestCase.assertNotAlmostEqual()TestCase.assertGreater()TestCase.assertGreaterEqual()TestCase.assertLess()TestCase.assertLessEqual()TestCase.assertRegex()TestCase.assertNotRegex()TestCase.assertCountEqual()TestCase.addTypeEqualityFunc()TestCase.assertMultiLineEqual()TestCase.assertSequenceEqual()TestCase.assertListEqual()TestCase.assertTupleEqual()TestCase.assertSetEqual()TestCase.assertDictEqual()TestCase.fail()TestCase.failureExceptionTestCase.longMessageTestCase.maxDiffTestCase.countTestCases()TestCase.defaultTestResult()TestCase.id()TestCase.shortDescription()TestCase.addCleanup()TestCase.enterContext()TestCase.doCleanups()TestCase.addClassCleanup()TestCase.enterClassContext()TestCase.doClassCleanups()
IsolatedAsyncioTestCaseFunctionTestCase
- Grouping tests
- Loading and running tests
TestLoaderTestLoader.errorsTestLoader.loadTestsFromTestCase()TestLoader.loadTestsFromModule()TestLoader.loadTestsFromName()TestLoader.loadTestsFromNames()TestLoader.getTestCaseNames()TestLoader.discover()TestLoader.testMethodPrefixTestLoader.sortTestMethodsUsingTestLoader.suiteClassTestLoader.testNamePatterns
TestResultTestResult.errorsTestResult.failuresTestResult.skippedTestResult.expectedFailuresTestResult.unexpectedSuccessesTestResult.collectedDurationsTestResult.shouldStopTestResult.testsRunTestResult.bufferTestResult.failfastTestResult.tb_localsTestResult.wasSuccessful()TestResult.stop()TestResult.startTest()TestResult.stopTest()TestResult.startTestRun()TestResult.stopTestRun()TestResult.addError()TestResult.addFailure()TestResult.addSuccess()TestResult.addSkip()TestResult.addExpectedFailure()TestResult.addUnexpectedSuccess()TestResult.addSubTest()TestResult.addDuration()
TextTestResultdefaultTestLoaderTextTestRunnermain()- load_tests Protocol
- Test cases
- Class and Module Fixtures
- Signal Handling
unittest.mock— mock 物件函式庫- 快速導引
- Mock 類別
MockMock.assert_called()Mock.assert_called_once()Mock.assert_called_with()Mock.assert_called_once_with()Mock.assert_any_call()Mock.assert_has_calls()Mock.assert_not_called()Mock.reset_mock()Mock.mock_add_spec()Mock.attach_mock()Mock.configure_mock()Mock.__dir__()Mock._get_child_mock()Mock.calledMock.call_countMock.return_valueMock.side_effectMock.call_argsMock.call_args_listMock.method_callsMock.mock_callsMock.__class__
NonCallableMockPropertyMockAsyncMockAsyncMock.assert_awaited()AsyncMock.assert_awaited_once()AsyncMock.assert_awaited_with()AsyncMock.assert_awaited_once_with()AsyncMock.assert_any_await()AsyncMock.assert_has_awaits()AsyncMock.assert_not_awaited()AsyncMock.reset_mock()AsyncMock.await_countAsyncMock.await_argsAsyncMock.await_args_list
- 呼叫
- Deleting Attributes
- Mock names and the name attribute
- Attaching Mocks as Attributes
- The patchers
- MagicMock and magic method support
- Helpers
unittest.mock--- 入門指南- 使用 Mock 的方式
- 使用 Mock 來 patching 方法
- 對物件的方法呼叫使用 mock
- Mocking Classes
- Naming your mocks
- Tracking all Calls
- Setting Return Values and Attributes
- Raising exceptions with mocks
- Side effect functions and iterables
- Mocking asynchronous iterators
- Mocking asynchronous context manager
- Creating a Mock from an Existing Object
- Using side_effect to return per file content
- 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
- 使用 Mock 的方式
- 2to3 --- 自動將 Python 2的程式碼轉成 Python 3
test--- Python 的回歸測試 (regression tests) 套件test.support--- Python 測試套件的工具TestFailedResourceDeniedverboseis_jythonis_androidunix_shellLOOPBACK_TIMEOUTINTERNET_TIMEOUTSHORT_TIMEOUTLONG_TIMEOUTPGOPIPE_MAX_SIZEPy_DEBUGSOCK_MAX_SIZETEST_SUPPORT_DIRTEST_HOME_DIRTEST_DATA_DIRMAX_Py_ssize_tmax_memusereal_max_memuseMISSING_C_DOCSTRINGSHAVE_DOCSTRINGSTEST_HTTP_URLALWAYS_EQNEVER_EQLARGESTSMALLESTbusy_retry()sleeping_retry()is_resource_enabled()python_is_optimized()with_pymalloc()requires()sortdict()findfile()get_pagesize()setswitchinterval()check_impl_detail()set_memlimit()record_original_stdout()get_original_stdout()args_from_interpreter_flags()optim_args_from_interpreter_flags()captured_stdin()captured_stdout()captured_stderr()disable_faulthandler()gc_collect()disable_gc()swap_attr()swap_item()flush_std_streams()print_warning()wait_process()calcobjsize()calcvobjsize()checksizeof()anticipate_failure()system_must_validate_cert()run_with_locale()run_with_tz()requires_freebsd_version()requires_linux_version()requires_mac_version()requires_IEEE_754()requires_zlib()requires_gzip()requires_bz2()requires_lzma()requires_resource()requires_docstrings()requires_limited_api()cpython_only()impl_detail()no_tracing()refcount_test()bigmemtest()bigaddrspacetest()check_syntax_error()open_urlresource()reap_children()get_attribute()catch_unraisable_exception()load_package_tests()detect_api_mismatch()patch()run_in_subinterp()check_free_after_iterating()missing_compiler_executable()check__all__()skip_if_broken_multiprocessing_synchronize()check_disallow_instantiation()adjust_int_max_str_digits()SuppressCrashReportSaveSignalsMatcher
test.support.socket_helper--- 用於 socket 測試的工具test.support.script_helper--- 用於 Python 執行測試的工具test.support.bytecode_helper--- 用於測試位元組碼能正確產生的支援工具test.support.threading_helper--- Utilities for threading teststest.support.os_helper--- 用於 os 測試的工具FS_NONASCIISAVEDCWDTESTFNTESTFN_NONASCIITESTFN_UNENCODABLETESTFN_UNDECODABLETESTFN_UNICODEEnvironmentVarGuardFakePathcan_symlink()can_xattr()change_cwd()create_empty_file()fd_count()fs_is_case_insensitive()make_bad_fd()rmdir()rmtree()skip_unless_symlink()skip_unless_xattr()temp_cwd()temp_dir()temp_umask()unlink()
test.support.import_helper--- 用於 import 測試的工具test.support.warnings_helper--- 用於 warnings 測試的工具
- 除錯與效能分析
- 稽核事件表
bdb--- Debugger frameworkBdbQuitBreakpointBdbBdb.canonic()Bdb.reset()Bdb.trace_dispatch()Bdb.dispatch_line()Bdb.dispatch_call()Bdb.dispatch_return()Bdb.dispatch_exception()Bdb.is_skipped_line()Bdb.stop_here()Bdb.break_here()Bdb.break_anywhere()Bdb.user_call()Bdb.user_line()Bdb.user_return()Bdb.user_exception()Bdb.do_clear()Bdb.set_step()Bdb.set_next()Bdb.set_return()Bdb.set_until()Bdb.set_trace()Bdb.set_continue()Bdb.set_quit()Bdb.set_break()Bdb.clear_break()Bdb.clear_bpbynumber()Bdb.clear_all_file_breaks()Bdb.clear_all_breaks()Bdb.get_bpbynumber()Bdb.get_break()Bdb.get_breaks()Bdb.get_file_breaks()Bdb.get_all_breaks()Bdb.get_stack()Bdb.format_stack_entry()Bdb.run()Bdb.runeval()Bdb.runctx()Bdb.runcall()
checkfuncname()effective()set_trace()
faulthandler--- Dump the Python tracebackpdb--- The Python Debugger- The Python Profilers
timeit--- 測量小量程式片段的執行時間trace--- Trace or track Python statement executiontracemalloc--- Trace memory allocations
- 軟體封裝與發布
- Python Runtime Services
sys--- 系統特定的參數與函式abiflagsaddaudithook()argvaudit()base_exec_prefixbase_prefixbyteorderbuiltin_module_namescall_tracing()copyright_clear_type_cache()_current_frames()_current_exceptions()breakpointhook()_debugmallocstats()dllhandledisplayhook()dont_write_bytecode_emscripten_infopycache_prefixexcepthook()__breakpointhook____displayhook____excepthook____unraisablehook__exception()exc_info()exec_prefixexecutableexit()flagsflags.debugflags.inspectflags.interactiveflags.isolatedflags.optimizeflags.dont_write_bytecodeflags.no_user_siteflags.no_siteflags.ignore_environmentflags.verboseflags.bytes_warningflags.quietflags.hash_randomizationflags.dev_modeflags.utf8_modeflags.safe_pathflags.int_max_str_digitsflags.warn_default_encoding
float_infofloat_repr_stylegetallocatedblocks()getunicodeinternedsize()getandroidapilevel()getdefaultencoding()getdlopenflags()getfilesystemencoding()getfilesystemencodeerrors()get_int_max_str_digits()getrefcount()getrecursionlimit()getsizeof()getswitchinterval()_getframe()_getframemodulename()getprofile()gettrace()getwindowsversion()get_asyncgen_hooks()get_coroutine_origin_tracking_depth()hash_infohexversionimplementationint_info__interactivehook__intern()is_finalizing()last_exclast_typelast_valuelast_tracebackmaxsizemaxunicodemeta_pathmodulesorig_argvpathpath_hookspath_importer_cacheplatformplatlibdirprefixps1ps2setdlopenflags()set_int_max_str_digits()setprofile()setrecursionlimit()setswitchinterval()settrace()set_asyncgen_hooks()set_coroutine_origin_tracking_depth()activate_stack_trampoline()deactivate_stack_trampoline()is_stack_trampoline_active()_enablelegacywindowsfsencoding()stdinstdoutstderr__stdin____stdout____stderr__stdlib_module_namesthread_infotracebacklimitunraisablehook()versionapi_versionversion_infowarnoptionswinver_xoptions
sys.monitoring--- Execution event monitoringsysconfig--- Provide access to Python's configuration informationbuiltins--- 內建物件__main__--- 頂層程式碼環境warnings--- Warning controldataclasses--- Data Classescontextlib--- Utilities forwith-statement contexts- Utilities
- Examples and Recipes
- Single use, reusable and reentrant context managers
abc--- 抽象基底類別atexit--- Exit handlerstraceback--- Print or retrieve a stack tracebackprint_tb()print_exception()print_exc()print_last()print_stack()extract_tb()extract_stack()format_list()format_exception_only()format_exception()format_exc()format_tb()format_stack()clear_frames()walk_stack()walk_tb()TracebackException物件TracebackExceptionTracebackException.__cause__TracebackException.__context__TracebackException.exceptionsTracebackException.__suppress_context__TracebackException.__notes__TracebackException.stackTracebackException.exc_typeTracebackException.filenameTracebackException.linenoTracebackException.end_linenoTracebackException.textTracebackException.offsetTracebackException.end_offsetTracebackException.msgTracebackException.from_exception()TracebackException.print()TracebackException.format()TracebackException.format_exception_only()
StackSummary物件FrameSummary物件- Traceback Examples
__future__--- Future 陳述式定義gc--- 垃圾回收器介面 (Garbage Collector interface)enable()disable()isenabled()collect()set_debug()get_debug()get_objects()get_stats()set_threshold()get_count()get_threshold()get_referrers()get_referents()is_tracked()is_finalized()freeze()unfreeze()get_freeze_count()garbagecallbacksDEBUG_STATSDEBUG_COLLECTABLEDEBUG_UNCOLLECTABLEDEBUG_SAVEALLDEBUG_LEAK
inspect--- 檢視活動物件- Types and members
getmembers()getmembers_static()getmodulename()ismodule()isclass()ismethod()isfunction()isgeneratorfunction()isgenerator()iscoroutinefunction()markcoroutinefunction()iscoroutine()isawaitable()isasyncgenfunction()isasyncgen()istraceback()isframe()iscode()isbuiltin()ismethodwrapper()isroutine()isabstract()ismethoddescriptor()isdatadescriptor()isgetsetdescriptor()ismemberdescriptor()
- Retrieving source code
- Introspecting callables with the Signature object
- 類別與函式
- The interpreter stack
- Fetching attributes statically
- Current State of Generators, Coroutines, and Asynchronous Generators
- Code Objects Bit Flags
- Buffer flags
BufferFlagsBufferFlags.SIMPLEBufferFlags.WRITABLEBufferFlags.FORMATBufferFlags.NDBufferFlags.STRIDESBufferFlags.C_CONTIGUOUSBufferFlags.F_CONTIGUOUSBufferFlags.ANY_CONTIGUOUSBufferFlags.INDIRECTBufferFlags.CONTIGBufferFlags.CONTIG_ROBufferFlags.STRIDEDBufferFlags.STRIDED_ROBufferFlags.RECORDSBufferFlags.RECORDS_ROBufferFlags.FULLBufferFlags.FULL_ROBufferFlags.READBufferFlags.WRITE
- 命令列介面
- Types and members
site--- Site-specific configuration hook
- Custom Python Interpreters
- 引入模組
zipimport--- Import modules from Zip archivespkgutil--- Package extension utilitymodulefinder--- Find modules used by a scriptrunpy--- Locating and executing Python modulesimportlib---import的實作- 簡介
- 函式
importlib.abc-- Abstract base classes related to importimportlib.machinery-- Importers and path hooksimportlib.util-- Utility code for importers- 範例
importlib.resources-- Package resource reading, opening and accessimportlib.resources.abc-- Abstract base classes for resourcesimportlib.metadata-- Accessing package metadata- The initialization of the
sys.pathmodule search path
- Python Language Services
ast--- 抽象語法樹 (Abstract Syntax Trees)- 抽象文法 (Abstract Grammar)
- 節點 (Node) 類別
AST- 根節點
- 文本 (Literals)
- 變數
- 運算式
- 陳述式
- 流程控制
- 模式匹配 (pattern matching)
- 型別參數 (type parameters)
- 函式和類別定義
- async 和 await
ast輔助程式- 編譯器旗標
- 命令列用法
symtable--- 存取編譯器的符號表token--- Constants used with Python parse treestok_nameISTERMINAL()ISNONTERMINAL()ISEOF()ENDMARKERNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTLBRACERBRACEEQEQUALNOTEQUALLESSEQUALGREATEREQUALTILDECIRCUMFLEXLEFTSHIFTRIGHTSHIFTDOUBLESTARPLUSEQUALMINEQUALSTAREQUALSLASHEQUALPERCENTEQUALAMPEREQUALVBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUALDOUBLESLASHDOUBLESLASHEQUALATATEQUALRARROWELLIPSISCOLONEQUALEXCLAMATIONOPAWAITASYNCTYPE_IGNORETYPE_COMMENTSOFT_KEYWORDFSTRING_STARTFSTRING_MIDDLEFSTRING_ENDCOMMENTNLERRORTOKENN_TOKENSNT_OFFSETENCODING
keyword--- 檢驗 Python 關鍵字tokenize--- Tokenizer for Python sourcetabnanny--- 偵測不良縮排pyclbr--- Python module browser supportpy_compile— 編譯 Python 來源檔案compileall--- Byte-compile Python librariesdis--- Python bytecode的反組譯器pickletools--- pickle 開發者的工具
- MS Windows 特有服務
msvcrt--- Useful routines from the MS VC++ runtimewinreg--- Windows registry access- 函式
CloseKey()ConnectRegistry()CreateKey()CreateKeyEx()DeleteKey()DeleteKeyEx()DeleteValue()EnumKey()EnumValue()ExpandEnvironmentStrings()FlushKey()LoadKey()OpenKey()OpenKeyEx()QueryInfoKey()QueryValue()QueryValueEx()SaveKey()SetValue()SetValueEx()DisableReflectionKey()EnableReflectionKey()QueryReflectionKey()
- 常數
- Registry Handle Objects
- 函式
winsound--- Sound-playing interface for Windows
- Unix 特有服務
posix--- 最常見的 POSIX 系統呼叫pwd--- 密碼資料庫grp--- The group databasetermios--- POSIX style tty controltty--- 終端機控制函式pty--- Pseudo-terminal utilitiesfcntl--- Thefcntlandioctlsystem callsresource--- Resource usage informationerror- Resource Limits
RLIM_INFINITYgetrlimit()setrlimit()prlimit()RLIMIT_CORERLIMIT_CPURLIMIT_FSIZERLIMIT_DATARLIMIT_STACKRLIMIT_RSSRLIMIT_NPROCRLIMIT_NOFILERLIMIT_OFILERLIMIT_MEMLOCKRLIMIT_VMEMRLIMIT_ASRLIMIT_MSGQUEUERLIMIT_NICERLIMIT_RTPRIORLIMIT_RTTIMERLIMIT_SIGPENDINGRLIMIT_SBSIZERLIMIT_SWAPRLIMIT_NPTSRLIMIT_KQUEUES
- Resource Usage
syslog--- Unix syslog library routines
- 模組命令列介面
- 已被取代的模組
aifc--- 讀寫 AIFF 與 AIFC 檔案open()aifc.getnchannels()aifc.getsampwidth()aifc.getframerate()aifc.getnframes()aifc.getcomptype()aifc.getcompname()aifc.getparams()aifc.getmarkers()aifc.getmark()aifc.readframes()aifc.rewind()aifc.setpos()aifc.tell()aifc.close()aifc.aiff()aifc.aifc()aifc.setnchannels()aifc.setsampwidth()aifc.setframerate()aifc.setnframes()aifc.setcomptype()aifc.setparams()aifc.setmark()aifc.writeframes()aifc.writeframesraw()
audioop--- 操作原始聲音檔案cgi--- 通用閘道器介面支援cgitb--- CGI 腳本的回溯 (traceback) 管理程式chunk--- 讀取 IFF 分塊資料crypt--- 用於檢查 Unix 密碼的函式imghdr--- 推測圖片種類mailcap--- Mailcap file handlingmsilib--- 讀寫 Microsoft Installer 檔案nis--- Sun NIS (Yellow Pages) 介面nntplib--- NNTP 協定客戶端NNTPNNTP_SSLNNTPErrorNNTPReplyErrorNNTPTemporaryErrorNNTPPermanentErrorNNTPProtocolErrorNNTPDataError- NNTP 物件
- 屬性
- Methods
NNTP.quit()NNTP.getwelcome()NNTP.getcapabilities()NNTP.login()NNTP.starttls()NNTP.newgroups()NNTP.newnews()NNTP.list()NNTP.descriptions()NNTP.description()NNTP.group()NNTP.over()NNTP.help()NNTP.stat()NNTP.next()NNTP.last()NNTP.article()NNTP.head()NNTP.body()NNTP.post()NNTP.ihave()NNTP.date()NNTP.slave()NNTP.set_debuglevel()NNTP.xhdr()NNTP.xover()
- Utility functions
optparse--- Parser for command line options- Background
- Tutorial
- Reference Guide
- 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 - Exceptions
ossaudiodev--- 對 OSS 相容聲音裝置的存取OSSAudioErroropen()openmixer()- Audio Device Objects
oss_audio_device.close()oss_audio_device.fileno()oss_audio_device.read()oss_audio_device.write()oss_audio_device.writeall()oss_audio_device.nonblock()oss_audio_device.getfmts()oss_audio_device.setfmt()oss_audio_device.channels()oss_audio_device.speed()oss_audio_device.sync()oss_audio_device.reset()oss_audio_device.post()oss_audio_device.setparameters()oss_audio_device.bufsize()oss_audio_device.obufcount()oss_audio_device.obuffree()oss_audio_device.closedoss_audio_device.nameoss_audio_device.mode
- Mixer Device Objects
pipes--- shell pipelines 介面sndhdr--- 判定聲音檔案的型別spwd--- shadow 密碼資料庫sunau--- 讀寫 Sun AU 檔案open()ErrorAUDIO_FILE_MAGICAUDIO_FILE_ENCODING_MULAW_8AUDIO_FILE_ENCODING_LINEAR_8AUDIO_FILE_ENCODING_LINEAR_16AUDIO_FILE_ENCODING_LINEAR_24AUDIO_FILE_ENCODING_LINEAR_32AUDIO_FILE_ENCODING_ALAW_8AUDIO_FILE_ENCODING_FLOATAUDIO_FILE_ENCODING_DOUBLEAUDIO_FILE_ENCODING_ADPCM_G721AUDIO_FILE_ENCODING_ADPCM_G722AUDIO_FILE_ENCODING_ADPCM_G723_3AUDIO_FILE_ENCODING_ADPCM_G723_5- AU_read 物件
- AU_write 物件
telnetlib--- Telnet 客戶端Telnet- Telnet Objects
Telnet.read_until()Telnet.read_all()Telnet.read_some()Telnet.read_very_eager()Telnet.read_eager()Telnet.read_lazy()Telnet.read_very_lazy()Telnet.read_sb_data()Telnet.open()Telnet.msg()Telnet.set_debuglevel()Telnet.close()Telnet.get_socket()Telnet.fileno()Telnet.write()Telnet.interact()Telnet.mt_interact()Telnet.expect()Telnet.set_option_negotiation_callback()
- Telnet 範例
xdrlib--- uuencode 檔案的編碼與解碼xdrlib--- XDR 資料的編碼與解碼PackerUnpacker- Packer Objects
- Unpacker Objects
Unpacker.reset()Unpacker.get_position()Unpacker.set_position()Unpacker.get_buffer()Unpacker.done()Unpacker.unpack_float()Unpacker.unpack_double()Unpacker.unpack_fstring()Unpacker.unpack_fopaque()Unpacker.unpack_string()Unpacker.unpack_opaque()Unpacker.unpack_bytes()Unpacker.unpack_list()Unpacker.unpack_farray()Unpacker.unpack_array()
- 例外
- 安全性注意事項
- 擴充和嵌入 Python 直譯器
- 推薦的第三方工具
- 不使用第三方工具建立擴充
- 1. 以 C 或 C++ 擴充 Python
- 1.1. 一個簡單範例
- 1.2. Intermezzo: Errors and Exceptions
- 1.3. 回到範例
- 1.4. The Module's Method Table and Initialization Function
- 1.5. Compilation and Linkage
- 1.6. Calling Python Functions from C
- 1.7. Extracting Parameters in Extension Functions
- 1.8. Keyword Parameters for Extension Functions
- 1.9. Building Arbitrary Values
- 1.10. Reference Counts
- 1.11. Writing Extensions in C++
- 1.12. Providing a C API for an Extension Module
- 2. Defining Extension Types: Tutorial
- 3. Defining Extension Types: Assorted Topics
- 4. 建立 C 與 C++ 擴充套件
- 5. Building C and C++ Extensions on Windows
- 1. 以 C 或 C++ 擴充 Python
- 在更大的應用程式中嵌入 CPython 運行環境 (runtime)
- Python/C API 參考手冊
- 簡介
- C API 穩定性
- The Very High Level Layer
- 參照計數
- 例外處理
- 工具
- 抽象物件層 (Abstract Objects Layer)
- 具體物件層
- 基礎物件
- 數值物件
- 序列物件
- 容器物件
- 函式物件
- 其他物件
- Initialization, Finalization, and Threads
- Before Python Initialization
- Global configuration variables
- Initializing and finalizing the interpreter
- Process-wide parameters
- Thread State and the Global Interpreter Lock
- Sub-interpreter support
- Asynchronous Notifications
- Profiling and Tracing
- Advanced Debugger Support
- Thread Local Storage Support
- Python Initialization Configuration
- 記憶體管理
- Object Implementation Support
- API 和 ABI 版本管理
- 安裝 Python 模組
- Python 如何達成任務
- 如何將 Python 2 的程式碼移植到 Python 3
- 簡短的說明
- 詳細的
- Different versions of Python 2
- Make sure you specify the proper version support in your
setup.pyfile - 有好的測試覆蓋率
- 注意 Python 2 & 3 的差異
- 更新你的程式碼
- Prevent compatibility regressions
- Check which dependencies block your transition
- Update your
setup.pyfile to denote Python 3 compatibility - Use continuous integration to stay compatible
- Consider using optional static type checking
- 遷移延伸模組到 Python 3
- Curses Programming with Python
- 描述器 HowTo 指南
- 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
- Dataclass support
- Pickling
- Functional API
- Derived Enumerations
- When to use
__new__()vs.__init__() - How are Enums and Flags different?
- Enum Cookbook
- Subclassing EnumType
- 函式編程 HOWTO
- 如何使用 Logging 模組
- Logging Cookbook
- Using logging in multiple modules
- Logging from multiple threads
- Multiple handlers and formatters
- Logging to multiple destinations
- Custom handling of levels
- Configuration server example
- Dealing with handlers that block
- Sending and receiving logging events across a network
- Adding contextual information to your logging output
- Use of
contextvars - Imparting contextual information in handlers
- Logging to a single file from multiple processes
- Using file rotation
- Use of alternative formatting styles
- Customizing
LogRecord - Subclassing QueueHandler - a ZeroMQ example
- Subclassing QueueListener - a ZeroMQ example
- An example dictionary-based configuration
- Using a rotator and namer to customize log rotation processing
- A more elaborate multiprocessing example
- Inserting a BOM into messages sent to a SysLogHandler
- Implementing structured logging
- Customizing handlers with
dictConfig() - Using particular formatting styles throughout your application
- Configuring filters with
dictConfig() - Customized exception formatting
- Speaking logging messages
- Buffering logging messages and outputting them conditionally
- Sending logging messages to email, with buffering
- Formatting times using UTC (GMT) via configuration
- Using a context manager for selective logging
- A CLI application starter template
- A Qt GUI for logging
- Logging to syslog with RFC5424 support
- How to treat a logger like an output stream
- Patterns to avoid
- Other resources
- 如何使用正規表達式
- Socket 程式設計指南
- 如何排序
- Unicode HOWTO
- 如何使用 urllib 套件取得網路資源
- Argparse 教學
- ipaddress 模組介紹
- 使用 DTrace 和 SystemTap 檢測 CPython
- Python 對 Linux
perf分析器的支援 - 註釋 (annotation) 最佳實踐
- Isolating Extension Modules
- Who should read this
- Background
- Making Modules Safe with Multiple Interpreters
- Heap Types
- Open Issues
- 如何將 Python 2 的程式碼移植到 Python 3
- Python 常見問題
- 一般的 Python 常見問答集
- 程式開發常見問答集
- 設計和歷史常見問答集
- 為什麼 Python 使用縮排將陳述式進行分組?
- 為什麼我會從簡單的數學運算得到奇怪的結果?
- 為何浮點數運算如此不精確?
- 為什麼 Python 字串不可變動?
- 為何「self」在方法 (method) 定義和呼叫時一定要明確使用?
- 為何我不能在運算式 (expression) 中使用指派運算?
- 為何 Python 對於一些功能實作使用方法(像是 list.index()),另一些使用函式(像是 len(list))?
- 為何 join() 是字串方法而非串列 (list) 或元組 (tuple) 方法?
- 例外處理有多快?
- 為什麼 Python 內沒有 switch 或 case 陳述式?
- 為何不能在直譯器上模擬執行緒,而要使用作業系統的特定實作方式?
- 為何 lambda 運算式不能包含陳述式?
- Python 可以被編譯成機器語言、C 語言或其他種語言嗎?
- Python 如何管理記憶體?
- 為何 CPython 不使用更多傳統的垃圾回收機制?
- 當 CPython 結束時,為何所有的記憶體不會被釋放?
- 為何要把元組 (tuple) 和串列 (list) 分成兩個資料型態?
- 串列 (list) 在 CPython 中是怎麼實作的?
- 字典 (dictionaries) 在 CPython 中是怎麼實作的?
- 為何字典的鍵一定是不可變的?
- 為何 list.sort() 不是回傳排序過的串列?
- 如何在 Python 中指定和強制使用一個介面規範 (interface spec)?
- 為何沒有 goto 語法?
- 為何純字串 (r-string) 不能以反斜線結尾?
- 為何 Python 沒有屬性賦值的 with 陳述式?
- 為何產生器 (generator) 不支援 with 陳述式?
- 為何 if、while、def、class 陳述式裡需要冒號?
- 為何 Python 允許在串列和元組末端加上逗號?
- 函式庫和擴充功能的常見問題
- 擴充/嵌入常見問題集
- 我可以在 C 中建立自己的函式嗎?
- 我可以在 C++ 中建立自己的函式嗎?
- 寫 C 很難;還有其他選擇嗎?
- 如何從 C 執行任意 Python 陳述式?
- How can I evaluate an arbitrary Python expression from C?
- 如何從 Python 物件中提取 C 值?
- 如何使用 Py_BuildValue() 建立任意長度的元組?
- 如何從 C 呼叫物件的方法?
- 我如何捕捉 PyErr_Print() 的輸出(或任何印出到 stdout/stderr 的東西)?
- 如何從 C 存取用 Python 編寫的模組?
- How do I interface to C++ objects from Python?
- 我使用安裝檔案新增了一個模組,但 make 失敗了;為什麼?
- 如何為擴充套件除錯?
- 我想在我的 Linux 系統上編譯一個 Python 模組,但是缺少一些檔案。為什麼?
- 如何從「無效輸入」區分出「不完整輸入」?
- 如何找到未定義的 g++ 符號 __builtin_new 或 __pure_virtual?
- Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?
- 在 Windows 使用 Python 的常見問答集
- 圖形使用者介面常見問答集
- 「為什麼 Python 被安裝在我的機器上?」常見問答集
- 術語表
- 關於這些說明文件
- 處理錯誤 (Bug)
- 版權宣告
- 沿革與授權