Python Documentation contents¶
- What’s New in Python
- What’s New In Python 3.11
- Summary – Release highlights
- New Features
- New Features Related to Type Hints
- Other Language Changes
- Other CPython Implementation Changes
- New Modules
- Improved Modules
- Optimizations
- Faster CPython
- CPython bytecode changes
- Deprecated
- Pending Removal in Python 3.12
- Removed
- Porting to Python 3.11
- Build Changes
- C API Changes
- What’s New In Python 3.10
- Summary – Release highlights
- New Features
- New Features Related to Type Hints
- Other Language Changes
- New Modules
- Improved Modules
- asyncio
- argparse
- array
- asynchat, asyncore, smtpd
- base64
- bdb
- bisect
- codecs
- collections.abc
- contextlib
- curses
- dataclasses
- distutils
- doctest
- encodings
- enum
- fileinput
- faulthandler
- gc
- glob
- hashlib
- hmac
- IDLE and idlelib
- importlib.metadata
- inspect
- itertools
- linecache
- os
- os.path
- pathlib
- platform
- pprint
- py_compile
- pyclbr
- shelve
- statistics
- site
- socket
- ssl
- sqlite3
- sys
- _thread
- threading
- traceback
- types
- typing
- unittest
- urllib.parse
- xml
- zipimport
- Optimizations
- Deprecated
- Removed
- Porting to Python 3.10
- CPython bytecode changes
- Build Changes
- C API Changes
- What’s New In Python 3.9
- What’s New In Python 3.8
- Summary – Release highlights
- New Features
- Assignment expressions
- Positional-only parameters
- Parallel filesystem cache for compiled bytecode files
- Debug build uses the same ABI as release build
- f-strings support
=
for self-documenting expressions and debugging - PEP 578: Python Runtime Audit Hooks
- PEP 587: Python Initialization Configuration
- PEP 590: Vectorcall: a fast calling protocol for CPython
- Pickle protocol 5 with out-of-band data buffers
- Other Language Changes
- New Modules
- Improved Modules
- ast
- asyncio
- builtins
- collections
- cProfile
- csv
- curses
- ctypes
- datetime
- functools
- gc
- gettext
- gzip
- IDLE and idlelib
- inspect
- io
- itertools
- json.tool
- logging
- math
- mmap
- multiprocessing
- os
- os.path
- pathlib
- pickle
- plistlib
- pprint
- py_compile
- shlex
- shutil
- socket
- ssl
- statistics
- sys
- tarfile
- threading
- tokenize
- tkinter
- time
- typing
- unicodedata
- unittest
- venv
- weakref
- xml
- xmlrpc
- Optimizations
- Build and C API Changes
- Deprecated
- API and Feature Removals
- Porting to Python 3.8
- Notable changes in Python 3.8.1
- Notable changes in Python 3.8.8
- Notable changes in Python 3.8.12
- What’s New In Python 3.7
- Summary – Release Highlights
- New Features
- PEP 563: Postponed Evaluation of Annotations
- PEP 538: Legacy C Locale Coercion
- PEP 540: Forced UTF-8 Runtime Mode
- PEP 553: Built-in
breakpoint()
- PEP 539: New C API for Thread-Local Storage
- PEP 562: Customization of Access to Module Attributes
- PEP 564: New Time Functions With Nanosecond Resolution
- PEP 565: Show DeprecationWarning in
__main__
- PEP 560: Core Support for
typing
module and Generic Types - PEP 552: Hash-based .pyc Files
- PEP 545: Python Documentation Translations
- Python Development Mode (-X dev)
- Other Language Changes
- New Modules
- Improved Modules
- argparse
- asyncio
- binascii
- calendar
- collections
- compileall
- concurrent.futures
- contextlib
- cProfile
- crypt
- datetime
- dbm
- decimal
- dis
- distutils
- enum
- functools
- gc
- hmac
- http.client
- http.server
- idlelib and IDLE
- importlib
- io
- ipaddress
- itertools
- locale
- logging
- math
- mimetypes
- msilib
- multiprocessing
- os
- pathlib
- pdb
- py_compile
- pydoc
- queue
- re
- signal
- socket
- socketserver
- sqlite3
- ssl
- string
- subprocess
- sys
- time
- tkinter
- tracemalloc
- types
- unicodedata
- unittest
- unittest.mock
- urllib.parse
- uu
- uuid
- warnings
- xml.etree
- xmlrpc.server
- zipapp
- zipfile
- C API Changes
- Build Changes
- Optimizations
- Other CPython Implementation Changes
- Deprecated Python Behavior
- Deprecated Python modules, functions and methods
- Deprecated functions and types of the C API
- Platform Support Removals
- API and Feature Removals
- Module Removals
- Windows-only Changes
- Porting to Python 3.7
- Notable changes in Python 3.7.1
- Notable changes in Python 3.7.2
- Notable changes in Python 3.7.6
- Notable changes in Python 3.7.10
- What’s New In Python 3.6
- Summary – Release highlights
- New Features
- PEP 498: Formatted string literals
- PEP 526: Syntax for variable annotations
- PEP 515: Underscores in Numeric Literals
- PEP 525: Asynchronous Generators
- PEP 530: Asynchronous Comprehensions
- PEP 487: Simpler customization of class creation
- PEP 487: Descriptor Protocol Enhancements
- PEP 519: Adding a file system path protocol
- PEP 495: Local Time Disambiguation
- PEP 529: Change Windows filesystem encoding to UTF-8
- PEP 528: Change Windows console encoding to UTF-8
- PEP 520: Preserving Class Attribute Definition Order
- PEP 468: Preserving Keyword Argument Order
- New dict implementation
- PEP 523: Adding a frame evaluation API to CPython
- PYTHONMALLOC environment variable
- DTrace and SystemTap probing support
- Other Language Changes
- New Modules
- Improved Modules
- array
- ast
- asyncio
- binascii
- cmath
- collections
- concurrent.futures
- contextlib
- datetime
- decimal
- distutils
- encodings
- enum
- faulthandler
- fileinput
- hashlib
- http.client
- idlelib and IDLE
- importlib
- inspect
- json
- logging
- math
- multiprocessing
- os
- pathlib
- pdb
- pickle
- pickletools
- pydoc
- random
- re
- readline
- rlcompleter
- shlex
- site
- sqlite3
- socket
- socketserver
- ssl
- statistics
- struct
- subprocess
- sys
- telnetlib
- time
- timeit
- tkinter
- traceback
- tracemalloc
- typing
- unicodedata
- unittest.mock
- urllib.request
- urllib.robotparser
- venv
- warnings
- winreg
- winsound
- xmlrpc.client
- zipfile
- zlib
- Optimizations
- Build and C API Changes
- Other Improvements
- Deprecated
- Removed
- Porting to Python 3.6
- Notable changes in Python 3.6.2
- Notable changes in Python 3.6.4
- Notable changes in Python 3.6.5
- Notable changes in Python 3.6.7
- Notable changes in Python 3.6.10
- Notable changes in Python 3.6.13
- What’s New In Python 3.5
- Summary – Release highlights
- New Features
- PEP 492 - Coroutines with async and await syntax
- PEP 465 - A dedicated infix operator for matrix multiplication
- PEP 448 - Additional Unpacking Generalizations
- PEP 461 - percent formatting support for bytes and bytearray
- PEP 484 - Type Hints
- PEP 471 - os.scandir() function – a better and faster directory iterator
- PEP 475: Retry system calls failing with EINTR
- PEP 479: Change StopIteration handling inside generators
- PEP 485: A function for testing approximate equality
- PEP 486: Make the Python Launcher aware of virtual environments
- PEP 488: Elimination of PYO files
- PEP 489: Multi-phase extension module initialization
- Other Language Changes
- New Modules
- Improved Modules
- argparse
- asyncio
- bz2
- cgi
- cmath
- code
- collections
- collections.abc
- compileall
- concurrent.futures
- configparser
- contextlib
- csv
- curses
- dbm
- difflib
- distutils
- doctest
- enum
- faulthandler
- functools
- glob
- gzip
- heapq
- http
- http.client
- idlelib and IDLE
- imaplib
- imghdr
- importlib
- inspect
- io
- ipaddress
- json
- linecache
- locale
- logging
- lzma
- math
- multiprocessing
- operator
- os
- pathlib
- pickle
- poplib
- re
- readline
- selectors
- shutil
- signal
- smtpd
- smtplib
- sndhdr
- socket
- ssl
- sqlite3
- subprocess
- sys
- sysconfig
- tarfile
- threading
- time
- timeit
- tkinter
- traceback
- types
- unicodedata
- unittest
- unittest.mock
- urllib
- wsgiref
- xmlrpc
- xml.sax
- zipfile
- Other module-level changes
- Optimizations
- Build and C API Changes
- Deprecated
- Removed
- Porting to Python 3.5
- Notable changes in Python 3.5.4
- What’s New In Python 3.4
- Summary – Release Highlights
- New Features
- New Modules
- Improved Modules
- abc
- aifc
- argparse
- audioop
- base64
- collections
- colorsys
- contextlib
- dbm
- dis
- doctest
- filecmp
- functools
- gc
- glob
- hashlib
- hmac
- html
- http
- idlelib and IDLE
- importlib
- inspect
- ipaddress
- logging
- marshal
- mmap
- multiprocessing
- operator
- os
- pdb
- pickle
- plistlib
- poplib
- pprint
- pty
- pydoc
- re
- resource
- select
- shelve
- shutil
- smtpd
- smtplib
- socket
- sqlite3
- ssl
- stat
- struct
- subprocess
- sunau
- sys
- tarfile
- textwrap
- threading
- traceback
- types
- urllib
- unittest
- venv
- wave
- weakref
- xml.etree
- zipfile
- CPython Implementation Changes
- Deprecated
- Removed
- Porting to Python 3.4
- Changed in 3.4.3
- What’s New In Python 3.3
- Summary – Release highlights
- PEP 405: Virtual Environments
- PEP 420: Implicit Namespace Packages
- PEP 3118: New memoryview implementation and buffer protocol documentation
- PEP 393: Flexible String Representation
- PEP 397: Python Launcher for Windows
- PEP 3151: Reworking the OS and IO exception hierarchy
- PEP 380: Syntax for Delegating to a Subgenerator
- PEP 409: Suppressing exception context
- PEP 414: Explicit Unicode literals
- PEP 3155: Qualified name for classes and functions
- PEP 412: Key-Sharing Dictionary
- PEP 362: Function Signature Object
- PEP 421: Adding sys.implementation
- Using importlib as the Implementation of Import
- Other Language Changes
- A Finer-Grained Import Lock
- Builtin functions and types
- New Modules
- Improved Modules
- abc
- array
- base64
- binascii
- bz2
- codecs
- collections
- contextlib
- crypt
- curses
- datetime
- decimal
- ftplib
- functools
- gc
- hmac
- http
- html
- imaplib
- inspect
- io
- itertools
- logging
- math
- mmap
- multiprocessing
- nntplib
- os
- pdb
- pickle
- pydoc
- re
- sched
- select
- shlex
- shutil
- signal
- smtpd
- smtplib
- socket
- socketserver
- sqlite3
- ssl
- stat
- struct
- subprocess
- sys
- tarfile
- tempfile
- textwrap
- threading
- time
- types
- unittest
- urllib
- webbrowser
- xml.etree.ElementTree
- zlib
- Optimizations
- Build and C API Changes
- Deprecated
- Porting to Python 3.3
- What’s New In Python 3.2
- PEP 384: Defining a Stable ABI
- PEP 389: Argparse Command Line Parsing Module
- PEP 391: Dictionary Based Configuration for Logging
- PEP 3148: The
concurrent.futures
module - PEP 3147: PYC Repository Directories
- PEP 3149: ABI Version Tagged .so Files
- PEP 3333: Python Web Server Gateway Interface v1.0.1
- Other Language Changes
- New, Improved, and Deprecated Modules
- elementtree
- functools
- itertools
- collections
- threading
- datetime and time
- math
- abc
- io
- reprlib
- logging
- csv
- contextlib
- decimal and fractions
- ftp
- popen
- select
- gzip and zipfile
- tarfile
- hashlib
- ast
- os
- shutil
- sqlite3
- html
- socket
- ssl
- nntp
- certificates
- imaplib
- http.client
- unittest
- random
- poplib
- asyncore
- tempfile
- inspect
- pydoc
- dis
- dbm
- ctypes
- site
- sysconfig
- pdb
- configparser
- urllib.parse
- mailbox
- turtledemo
- Multi-threading
- Optimizations
- Unicode
- Codecs
- Documentation
- IDLE
- Code Repository
- Build and C API Changes
- Porting to Python 3.2
- What’s New In Python 3.1
- What’s New In Python 3.0
- What’s New in Python 2.7
- The Future for Python 2.x
- Changes to the Handling of Deprecation Warnings
- Python 3.1 Features
- PEP 372: Adding an Ordered Dictionary to collections
- PEP 378: Format Specifier for Thousands Separator
- PEP 389: The argparse Module for Parsing Command Lines
- PEP 391: Dictionary-Based Configuration For Logging
- PEP 3106: Dictionary Views
- PEP 3137: The memoryview Object
- Other Language Changes
- New and Improved Modules
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.7
- New Features Added to Python 2.7 Maintenance Releases
- Two new environment variables for debug mode
- PEP 434: IDLE Enhancement Exception for All Branches
- PEP 466: Network Security Enhancements for Python 2.7
- PEP 477: Backport ensurepip (PEP 453) to Python 2.7
- PEP 476: Enabling certificate verification by default for stdlib http clients
- PEP 493: HTTPS verification migration tools for Python 2.7
- New
make regen-all
build target - Removal of
make touch
build target
- Acknowledgements
- What’s New in Python 2.6
- Python 3.0
- Changes to the Development Process
- PEP 343: The ‘with’ statement
- PEP 366: Explicit Relative Imports From a Main Module
- PEP 370: Per-user
site-packages
Directory - PEP 371: The
multiprocessing
Package - PEP 3101: Advanced String Formatting
- PEP 3105:
print
As a Function - PEP 3110: Exception-Handling Changes
- PEP 3112: Byte Literals
- PEP 3116: New I/O Library
- PEP 3118: Revised Buffer Protocol
- PEP 3119: Abstract Base Classes
- PEP 3127: Integer Literal Support and Syntax
- PEP 3129: Class Decorators
- PEP 3141: A Type Hierarchy for Numbers
- Other Language Changes
- New and Improved Modules
- Deprecations and Removals
- Build and C API Changes
- Porting to Python 2.6
- Acknowledgements
- What’s New in Python 2.5
- PEP 308: Conditional Expressions
- PEP 309: Partial Function Application
- PEP 314: Metadata for Python Software Packages v1.1
- PEP 328: Absolute and Relative Imports
- PEP 338: Executing Modules as Scripts
- PEP 341: Unified try/except/finally
- PEP 342: New Generator Features
- PEP 343: The ‘with’ statement
- PEP 352: Exceptions as New-Style Classes
- PEP 353: Using ssize_t as the index type
- PEP 357: The ‘__index__’ method
- Other Language Changes
- New, Improved, and Removed Modules
- Build and C API Changes
- Porting to Python 2.5
- Acknowledgements
- What’s New in Python 2.4
- PEP 218: Built-In Set Objects
- PEP 237: Unifying Long Integers and Integers
- PEP 289: Generator Expressions
- PEP 292: Simpler String Substitutions
- PEP 318: Decorators for Functions and Methods
- PEP 322: Reverse Iteration
- PEP 324: New subprocess Module
- PEP 327: Decimal Data Type
- PEP 328: Multi-line Imports
- PEP 331: Locale-Independent Float/String Conversions
- Other Language Changes
- New, Improved, and Deprecated Modules
- Build and C API Changes
- Porting to Python 2.4
- Acknowledgements
- What’s New in Python 2.3
- PEP 218: A Standard Set Datatype
- PEP 255: Simple Generators
- PEP 263: Source Code Encodings
- PEP 273: Importing Modules from ZIP Archives
- PEP 277: Unicode file name support for Windows NT
- PEP 278: Universal Newline Support
- PEP 279: enumerate()
- PEP 282: The logging Package
- PEP 285: A Boolean Type
- PEP 293: Codec Error Handling Callbacks
- PEP 301: Package Index and Metadata for Distutils
- PEP 302: New Import Hooks
- PEP 305: Comma-separated Files
- PEP 307: Pickle Enhancements
- Extended Slices
- Other Language Changes
- New, Improved, and Deprecated Modules
- Pymalloc: A Specialized Object Allocator
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.3
- Acknowledgements
- What’s New in Python 2.2
- Introduction
- PEPs 252 and 253: Type and Class Changes
- PEP 234: Iterators
- PEP 255: Simple Generators
- PEP 237: Unifying Long Integers and Integers
- PEP 238: Changing the Division Operator
- Unicode Changes
- PEP 227: Nested Scopes
- New and Improved Modules
- Interpreter Changes and Fixes
- Other Changes and Fixes
- Acknowledgements
- What’s New in Python 2.1
- Introduction
- PEP 227: Nested Scopes
- PEP 236: __future__ Directives
- PEP 207: Rich Comparisons
- PEP 230: Warning Framework
- PEP 229: New Build System
- PEP 205: Weak References
- PEP 232: Function Attributes
- PEP 235: Importing Modules on Case-Insensitive Platforms
- PEP 217: Interactive Display Hook
- PEP 208: New Coercion Model
- PEP 241: Metadata in Python Packages
- New and Improved Modules
- Other Changes and Fixes
- Acknowledgements
- What’s New in Python 2.0
- Introduction
- What About Python 1.6?
- New Development Process
- Unicode
- List Comprehensions
- Augmented Assignment
- String Methods
- Garbage Collection of Cycles
- Other Core Changes
- Porting to 2.0
- Extending/Embedding Changes
- Distutils: Making Modules Easy to Install
- XML Modules
- Module changes
- New modules
- IDLE Improvements
- Deleted and Deprecated Modules
- Acknowledgements
- Changelog
- Python 3.11.2 final
- Python 3.11.1 final
- Python 3.11.0 final
- Python 3.11.0 release candidate 2
- Python 3.11.0 release candidate 1
- Python 3.11.0 beta 5
- Python 3.11.0 beta 4
- Python 3.11.0 beta 3
- Python 3.11.0 beta 2
- 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
- What’s New In Python 3.11
- The Python Tutorial
- 1. Whetting Your Appetite
- 2. Using the Python Interpreter
- 3. An Informal Introduction to Python
- 4. More Control Flow Tools
- 4.1.
if
Statements - 4.2.
for
Statements - 4.3. The
range()
Function - 4.4.
break
andcontinue
Statements, andelse
Clauses on Loops - 4.5.
pass
Statements - 4.6.
match
Statements - 4.7. Defining Functions
- 4.8. More on Defining Functions
- 4.9. Intermezzo: Coding Style
- 4.1.
- 5. Data Structures
- 6. Modules
- 7. Input and Output
- 8. Errors and Exceptions
- 9. Classes
- 10. Brief Tour of the Standard Library
- 10.1. Operating System Interface
- 10.2. File Wildcards
- 10.3. Command Line Arguments
- 10.4. Error Output Redirection and Program Termination
- 10.5. String Pattern Matching
- 10.6. Mathematics
- 10.7. Internet Access
- 10.8. Dates and Times
- 10.9. Data Compression
- 10.10. Performance Measurement
- 10.11. Quality Control
- 10.12. Batteries Included
- 11. Brief Tour of the Standard Library — Part II
- 12. Virtual Environments and Packages
- 13. What Now?
- 14. Interactive Input Editing and History Substitution
- 15. Floating Point Arithmetic: Issues and Limitations
- 16. Appendix
- Python Setup and Usage
- 1. Command line and environment
- 2. Using Python on Unix platforms
- 3. Configure Python
- 4. Using Python on Windows
- 4.1. The full installer
- 4.2. The Microsoft Store package
- 4.3. The nuget.org packages
- 4.4. The embeddable package
- 4.5. Alternative bundles
- 4.6. Configuring Python
- 4.7. UTF-8 mode
- 4.8. Python Launcher for Windows
- 4.9. Finding modules
- 4.10. Additional modules
- 4.11. Compiling Python on Windows
- 4.12. Other Platforms
- 5. Using Python on a Mac
- 6. Editors and IDEs
- The Python Language Reference
- 1. Introduction
- 2. Lexical analysis
- 3. Data model
- 3.1. Objects, values and types
- 3.2. The standard type hierarchy
- 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. Special method lookup
- 3.4. Coroutines
- 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
assert
statement - 7.4. The
pass
statement - 7.5. The
del
statement - 7.6. The
return
statement - 7.7. The
yield
statement - 7.8. The
raise
statement - 7.9. The
break
statement - 7.10. The
continue
statement - 7.11. The
import
statement - 7.12. The
global
statement - 7.13. The
nonlocal
statement
- 8. Compound statements
- 9. Top-level components
- 10. Full Grammar specification
- The Python Standard Library
- Introduction
- Built-in Functions
abs()
aiter()
all()
anext()
any()
ascii()
bin()
bool
breakpoint()
callable()
chr()
classmethod()
compile()
complex
delattr()
dir()
divmod()
enumerate()
eval()
exec()
filter()
float
format()
getattr()
globals()
hasattr()
hash()
help()
hex()
id()
input()
int
isinstance()
issubclass()
iter()
len()
locals()
map()
max()
min()
next()
object
oct()
open()
ord()
pow()
print()
property
repr()
reversed()
round()
setattr()
slice
sorted()
staticmethod()
sum()
super
type
vars()
zip()
__import__()
- Built-in Constants
- Built-in Types
- Truth Value Testing
- Boolean Operations —
and
,or
,not
- Comparisons
- Numeric Types —
int
,float
,complex
- Iterator Types
- Sequence Types —
list
,tuple
,range
- Text Sequence Type —
str
str
- 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
memoryview
memoryview.__eq__()
memoryview.tobytes()
memoryview.hex()
memoryview.tolist()
memoryview.toreadonly()
memoryview.release()
memoryview.cast()
memoryview.obj
memoryview.nbytes
memoryview.readonly
memoryview.format
memoryview.itemsize
memoryview.ndim
memoryview.shape
memoryview.strides
memoryview.suboffsets
memoryview.c_contiguous
memoryview.f_contiguous
memoryview.contiguous
- Set Types —
set
,frozenset
set
frozenset
frozenset.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
- Built-in Exceptions
- Exception context
- Inheriting from built-in exceptions
- Base classes
- Concrete exceptions
AssertionError
AttributeError
EOFError
FloatingPointError
GeneratorExit
ImportError
ModuleNotFoundError
IndexError
KeyError
KeyboardInterrupt
MemoryError
NameError
NotImplementedError
OSError
OverflowError
RecursionError
ReferenceError
RuntimeError
StopIteration
StopAsyncIteration
SyntaxError
IndentationError
TabError
SystemError
SystemExit
TypeError
UnboundLocalError
UnicodeError
UnicodeEncodeError
UnicodeDecodeError
UnicodeTranslateError
ValueError
ZeroDivisionError
EnvironmentError
IOError
WindowsError
- OS exceptions
- Warnings
- Exception groups
- Exception hierarchy
- Text Processing Services
string
— Common string operationsre
— Regular expression operationsdifflib
— Helpers for computing deltasDiffer
HtmlDiff
context_diff()
get_close_matches()
ndiff()
restore()
unified_diff()
diff_bytes()
IS_LINE_JUNK()
IS_CHARACTER_JUNK()
- SequenceMatcher Objects
SequenceMatcher
SequenceMatcher.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 Examples
- Differ Objects
- Differ Example
- A command-line interface to difflib
textwrap
— Text wrapping and fillingwrap()
fill()
shorten()
dedent()
indent()
TextWrapper
TextWrapper.width
TextWrapper.expand_tabs
TextWrapper.tabsize
TextWrapper.replace_whitespace
TextWrapper.drop_whitespace
TextWrapper.initial_indent
TextWrapper.subsequent_indent
TextWrapper.fix_sentence_endings
TextWrapper.break_long_words
TextWrapper.break_on_hyphens
TextWrapper.max_lines
TextWrapper.placeholder
TextWrapper.wrap()
TextWrapper.fill()
unicodedata
— Unicode Databasestringprep
— Internet String Preparationreadline
— GNU readline interfacerlcompleter
— Completion function for GNU readline
- Binary Data Services
struct
— Interpret bytes as packed binary datacodecs
— Codec registry and base classesencode()
decode()
lookup()
CodecInfo
getencoder()
getdecoder()
getincrementalencoder()
getincrementaldecoder()
getreader()
getwriter()
register()
unregister()
open()
EncodedFile()
iterencode()
iterdecode()
BOM
BOM_BE
BOM_LE
BOM_UTF8
BOM_UTF16
BOM_UTF16_BE
BOM_UTF16_LE
BOM_UTF32
BOM_UTF32_BE
BOM_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
- Data Types
datetime
— Basic date and time types- Aware and Naive Objects
- Constants
- Available Types
timedelta
Objectsdate
Objectsdate
date.today()
date.fromtimestamp()
date.fromordinal()
date.fromisoformat()
date.fromisocalendar()
date.min
date.max
date.resolution
date.year
date.month
date.day
date.replace()
date.timetuple()
date.toordinal()
date.weekday()
date.isoweekday()
date.isocalendar()
date.isoformat()
date.__str__()
date.ctime()
date.strftime()
date.__format__()
- Examples of Usage:
date
datetime
Objectsdatetime
datetime.today()
datetime.now()
datetime.utcnow()
datetime.fromtimestamp()
datetime.utcfromtimestamp()
datetime.fromordinal()
datetime.combine()
datetime.fromisoformat()
datetime.fromisocalendar()
datetime.strptime()
datetime.min
datetime.max
datetime.resolution
datetime.year
datetime.month
datetime.day
datetime.hour
datetime.minute
datetime.second
datetime.microsecond
datetime.tzinfo
datetime.fold
datetime.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
Objectstzinfo
Objectstimezone
Objectsstrftime()
andstrptime()
Behavior
zoneinfo
— IANA time zone supportcalendar
— General calendar-related functionsCalendar
Calendar.iterweekdays()
Calendar.itermonthdates()
Calendar.itermonthdays()
Calendar.itermonthdays2()
Calendar.itermonthdays3()
Calendar.itermonthdays4()
Calendar.monthdatescalendar()
Calendar.monthdays2calendar()
Calendar.monthdayscalendar()
Calendar.yeardatescalendar()
Calendar.yeardays2calendar()
Calendar.yeardayscalendar()
TextCalendar
HTMLCalendar
LocaleTextCalendar
LocaleHTMLCalendar
setfirstweekday()
firstweekday()
isleap()
leapdays()
weekday()
weekheader()
monthrange()
monthcalendar()
prmonth()
month()
prcal()
calendar()
timegm()
day_name
day_abbr
month_name
month_abbr
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
SUNDAY
collections
— Container datatypescollections.abc
— Abstract Base Classes for Containersheapq
— Heap queue algorithmbisect
— Array bisection algorithmarray
— Efficient arrays of numeric valuestypecodes
array
array.typecode
array.itemsize
array.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
NoneType
FunctionType
LambdaType
GeneratorType
CoroutineType
AsyncGeneratorType
CodeType
CellType
MethodType
BuiltinFunctionType
BuiltinMethodType
WrapperDescriptorType
MethodWrapperType
NotImplementedType
MethodDescriptorType
ClassMethodDescriptorType
ModuleType
EllipsisType
GenericAlias
UnionType
TracebackType
FrameType
GetSetDescriptorType
MemberDescriptorType
MappingProxyType
- Additional Utility Classes and Functions
- Coroutine Utility Functions
copy
— Shallow and deep copy operationspprint
— Data pretty printerreprlib
— Alternaterepr()
implementationenum
— Support for enumerationsgraphlib
— Functionality to operate with graph-like structures
- Numeric and Mathematical Modules
numbers
— Numeric abstract base classesmath
— Mathematical functionscmath
— Mathematical functions for complex numbersdecimal
— Decimal fixed point and floating point arithmetic- Quick-start Tutorial
- Decimal objects
Decimal
Decimal.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()
BasicContext
ExtendedContext
DefaultContext
Context
Context.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()
- Constants
- Rounding modes
- Signals
- Floating Point Notes
- Working with threads
- Recipes
- Decimal FAQ
fractions
— Rational numbersrandom
— Generate pseudo-random numbersstatistics
— Mathematical statistics functions
- Functional Programming Modules
itertools
— Functions creating iterators for efficient loopingfunctools
— Higher-order functions and operations on callable objectsoperator
— Standard operators as functionslt()
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()
- Mapping Operators to Functions
- In-place Operators
- File and Directory Access
pathlib
— Object-oriented filesystem paths- Basic use
- Pure paths
PurePath
PurePosixPath
PureWindowsPath
- General properties
- Operators
- Accessing individual parts
- Methods and properties
PurePath.drive
PurePath.root
PurePath.anchor
PurePath.parents
PurePath.parent
PurePath.name
PurePath.suffix
PurePath.suffixes
PurePath.stem
PurePath.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()
- Concrete paths
Path
PosixPath
WindowsPath
- 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_mount()
Path.is_symlink()
Path.is_socket()
Path.is_fifo()
Path.is_block_device()
Path.is_char_device()
Path.iterdir()
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.link_to()
Path.touch()
Path.unlink()
Path.write_bytes()
Path.write_text()
- Correspondence to tools in the
os
module
os.path
— Common pathname manipulationsabspath()
basename()
commonpath()
commonprefix()
dirname()
exists()
lexists()
expanduser()
expandvars()
getatime()
getmtime()
getctime()
getsize()
isabs()
isfile()
isdir()
islink()
ismount()
join()
normcase()
normpath()
realpath()
relpath()
samefile()
sameopenfile()
samestat()
split()
splitdrive()
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_MODE
ST_INO
ST_DEV
ST_NLINK
ST_UID
ST_GID
ST_SIZE
ST_ATIME
ST_MTIME
ST_CTIME
S_IFSOCK
S_IFLNK
S_IFREG
S_IFBLK
S_IFDIR
S_IFCHR
S_IFIFO
S_IFDOOR
S_IFPORT
S_IFWHT
S_ISUID
S_ISGID
S_ISVTX
S_IRWXU
S_IRUSR
S_IWUSR
S_IXUSR
S_IRWXG
S_IRGRP
S_IWGRP
S_IXGRP
S_IRWXO
S_IROTH
S_IWOTH
S_IXOTH
S_ENFMT
S_IREAD
S_IWRITE
S_IEXEC
UF_NODUMP
UF_IMMUTABLE
UF_APPEND
UF_OPAQUE
UF_NOUNLINK
UF_COMPRESSED
UF_HIDDEN
SF_ARCHIVED
SF_IMMUTABLE
SF_APPEND
SF_NOUNLINK
SF_SNAPSHOT
FILE_ATTRIBUTE_ARCHIVE
FILE_ATTRIBUTE_COMPRESSED
FILE_ATTRIBUTE_DEVICE
FILE_ATTRIBUTE_DIRECTORY
FILE_ATTRIBUTE_ENCRYPTED
FILE_ATTRIBUTE_HIDDEN
FILE_ATTRIBUTE_INTEGRITY_STREAM
FILE_ATTRIBUTE_NORMAL
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
FILE_ATTRIBUTE_NO_SCRUB_DATA
FILE_ATTRIBUTE_OFFLINE
FILE_ATTRIBUTE_READONLY
FILE_ATTRIBUTE_REPARSE_POINT
FILE_ATTRIBUTE_SPARSE_FILE
FILE_ATTRIBUTE_SYSTEM
FILE_ATTRIBUTE_TEMPORARY
FILE_ATTRIBUTE_VIRTUAL
IO_REPARSE_TAG_SYMLINK
IO_REPARSE_TAG_MOUNT_POINT
IO_REPARSE_TAG_APPEXECLINK
filecmp
— File and Directory Comparisonscmp()
cmpfiles()
clear_cache()
- The
dircmp
classdircmp
dircmp.report()
dircmp.report_partial_closure()
dircmp.report_full_closure()
dircmp.left
dircmp.right
dircmp.left_list
dircmp.right_list
dircmp.common
dircmp.left_only
dircmp.right_only
dircmp.common_dirs
dircmp.common_files
dircmp.common_funny
dircmp.same_files
dircmp.diff_files
dircmp.funny_files
dircmp.subdirs
DEFAULT_IGNORES
tempfile
— Generate temporary files and directoriesglob
— Unix style pathname pattern expansionfnmatch
— 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
- Module Interface
- What can be pickled and unpickled?
- Pickling Class Instances
- Custom Reduction for Types, Functions, and Other Objects
- Out-of-band Buffers
- Restricting Globals
- Performance
- Examples
copyreg
— Registerpickle
support functionsshelve
— Python object persistencemarshal
— Internal Python object serializationdbm
— Interfaces to Unix “databases”sqlite3
— DB-API 2.0 interface for SQLite databases- Tutorial
- Reference
- Module functions
- Module constants
- Connection objects
Connection
Connection.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.serialize()
Connection.deserialize()
Connection.in_transaction
Connection.isolation_level
Connection.row_factory
Connection.text_factory
Connection.total_changes
- Cursor objects
- Row objects
- Blob objects
- PrepareProtocol objects
- Exceptions
- SQLite and Python types
- Default adapters and converters
- 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
- Explanation
- Data Compression and Archiving
zlib
— Compression compatible with gzipgzip
— Support for gzip filesbz2
— Support for bzip2 compressionlzma
— Compression using the LZMA algorithmzipfile
— Work with ZIP archivesBadZipFile
BadZipfile
LargeZipFile
ZipInfo
is_zipfile()
ZIP_STORED
ZIP_DEFLATED
ZIP_BZIP2
ZIP_LZMA
- ZipFile Objects
- Path Objects
- PyZipFile Objects
- ZipInfo Objects
ZipInfo.from_file()
ZipInfo.is_dir()
ZipInfo.filename
ZipInfo.date_time
ZipInfo.compress_type
ZipInfo.comment
ZipInfo.extra
ZipInfo.create_system
ZipInfo.create_version
ZipInfo.extract_version
ZipInfo.reserved
ZipInfo.flag_bits
ZipInfo.volume
ZipInfo.internal_attr
ZipInfo.external_attr
ZipInfo.header_offset
ZipInfo.CRC
ZipInfo.compress_size
ZipInfo.file_size
- Command-Line Interface
- Decompression pitfalls
tarfile
— Read and write tar archive filesopen()
is_tarfile()
TarError
ReadError
CompressionError
StreamError
ExtractError
HeaderError
ENCODING
USTAR_FORMAT
GNU_FORMAT
PAX_FORMAT
DEFAULT_FORMAT
- TarFile Objects
- TarInfo Objects
TarInfo
TarInfo.frombuf()
TarInfo.fromtarfile()
TarInfo.tobuf()
TarInfo.name
TarInfo.size
TarInfo.mtime
TarInfo.mode
TarInfo.type
TarInfo.linkname
TarInfo.uid
TarInfo.gid
TarInfo.uname
TarInfo.gname
TarInfo.pax_headers
TarInfo.isfile()
TarInfo.isreg()
TarInfo.isdir()
TarInfo.issym()
TarInfo.islnk()
TarInfo.ischr()
TarInfo.isblk()
TarInfo.isfifo()
TarInfo.isdev()
- Command-Line Interface
- Examples
- Supported tar formats
- Unicode issues
- File Formats
csv
— CSV File Reading and Writingconfigparser
— 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 Objects
ConfigParser
ConfigParser.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()
ConfigParser.readfp()
MAX_INTERPOLATION_DEPTH
- RawConfigParser Objects
- Exceptions
tomllib
— Parse TOML filesnetrc
— netrc file processingplistlib
— Generate and parse Apple.plist
files
- Cryptographic Services
- Generic Operating System Services
os
— Miscellaneous operating system interfaceserror
name
- File Names, Command Line Arguments, and Environment Variables
- Python UTF-8 Mode
- Process Parameters
ctermid()
environ
environb
fsencode()
fsdecode()
fspath()
PathLike
getenv()
getenvb()
get_exec_path()
getegid()
geteuid()
getgid()
getgrouplist()
getgroups()
getlogin()
getpgid()
getpgrp()
getpid()
getppid()
getpriority()
PRIO_PROCESS
PRIO_PGRP
PRIO_USER
getresuid()
getresgid()
getuid()
initgroups()
putenv()
setegid()
seteuid()
setgid()
setgroups()
setpgrp()
setpgid()
setpriority()
setregid()
setresgid()
setresuid()
setreuid()
getsid()
setsid()
setuid()
strerror()
supports_bytes_environ
umask()
uname()
unsetenv()
- 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_LOCK
F_TLOCK
F_ULOCK
F_TEST
login_tty()
lseek()
SEEK_SET
SEEK_CUR
SEEK_END
open()
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND
O_CREAT
O_EXCL
O_TRUNC
O_DSYNC
O_RSYNC
O_SYNC
O_NDELAY
O_NONBLOCK
O_NOCTTY
O_CLOEXEC
O_BINARY
O_NOINHERIT
O_SHORT_LIVED
O_TEMPORARY
O_RANDOM
O_SEQUENTIAL
O_TEXT
O_EVTONLY
O_FSYNC
O_SYMLINK
O_NOFOLLOW_ANY
O_ASYNC
O_DIRECT
O_DIRECTORY
O_NOFOLLOW
O_NOATIME
O_PATH
O_TMPFILE
O_SHLOCK
O_EXLOCK
openpty()
pipe()
pipe2()
posix_fallocate()
posix_fadvise()
POSIX_FADV_NORMAL
POSIX_FADV_SEQUENTIAL
POSIX_FADV_RANDOM
POSIX_FADV_NOREUSE
POSIX_FADV_WILLNEED
POSIX_FADV_DONTNEED
pread()
preadv()
RWF_NOWAIT
RWF_HIPRI
pwrite()
pwritev()
RWF_DSYNC
RWF_SYNC
RWF_APPEND
read()
sendfile()
set_blocking()
SF_NODISKIO
SF_MNOWAIT
SF_SYNC
SF_NOCACHE
splice()
SPLICE_F_MOVE
SPLICE_F_NONBLOCK
SPLICE_F_MORE
readv()
tcgetpgrp()
tcsetpgrp()
ttyname()
write()
writev()
- Querying the size of a terminal
- Inheritance of File Descriptors
- Files and Directories
access()
F_OK
R_OK
W_OK
X_OK
chdir()
chflags()
chmod()
chown()
chroot()
fchdir()
getcwd()
getcwdb()
lchflags()
lchmod()
lchown()
link()
listdir()
lstat()
mkdir()
makedirs()
mkfifo()
mknod()
major()
minor()
makedev()
pathconf()
pathconf_names
readlink()
remove()
removedirs()
rename()
renames()
replace()
rmdir()
scandir()
DirEntry
stat()
stat_result
stat_result.st_mode
stat_result.st_ino
stat_result.st_dev
stat_result.st_nlink
stat_result.st_uid
stat_result.st_gid
stat_result.st_size
stat_result.st_atime
stat_result.st_mtime
stat_result.st_ctime
stat_result.st_atime_ns
stat_result.st_mtime_ns
stat_result.st_ctime_ns
stat_result.st_blocks
stat_result.st_blksize
stat_result.st_rdev
stat_result.st_flags
stat_result.st_gen
stat_result.st_birthtime
stat_result.st_fstype
stat_result.st_rsize
stat_result.st_creator
stat_result.st_type
stat_result.st_file_attributes
stat_result.st_reparse_tag
statvfs()
supports_dir_fd
supports_effective_ids
supports_fd
supports_follow_symlinks
symlink()
sync()
truncate()
unlink()
utime()
walk()
fwalk()
memfd_create()
MFD_CLOEXEC
MFD_ALLOW_SEALING
MFD_HUGETLB
MFD_HUGE_SHIFT
MFD_HUGE_MASK
MFD_HUGE_64KB
MFD_HUGE_512KB
MFD_HUGE_1MB
MFD_HUGE_2MB
MFD_HUGE_8MB
MFD_HUGE_16MB
MFD_HUGE_32MB
MFD_HUGE_256MB
MFD_HUGE_512MB
MFD_HUGE_1GB
MFD_HUGE_2GB
MFD_HUGE_16GB
eventfd()
eventfd_read()
eventfd_write()
EFD_CLOEXEC
EFD_NONBLOCK
EFD_SEMAPHORE
- Linux extended attributes
- Process Management
abort()
add_dll_directory()
execl()
execle()
execlp()
execlpe()
execv()
execve()
execvp()
execvpe()
_exit()
EX_OK
EX_USAGE
EX_DATAERR
EX_NOINPUT
EX_NOUSER
EX_NOHOST
EX_UNAVAILABLE
EX_SOFTWARE
EX_OSERR
EX_OSFILE
EX_CANTCREAT
EX_IOERR
EX_TEMPFAIL
EX_PROTOCOL
EX_NOPERM
EX_CONFIG
EX_NOTFOUND
fork()
forkpty()
kill()
killpg()
nice()
pidfd_open()
plock()
popen()
posix_spawn()
POSIX_SPAWN_OPEN
POSIX_SPAWN_CLOSE
POSIX_SPAWN_DUP2
posix_spawnp()
register_at_fork()
spawnl()
spawnle()
spawnlp()
spawnlpe()
spawnv()
spawnve()
spawnvp()
spawnvpe()
P_NOWAIT
P_NOWAITO
P_WAIT
P_DETACH
P_OVERLAY
startfile()
system()
times()
wait()
waitid()
waitpid()
wait3()
wait4()
P_PID
P_PGID
P_ALL
P_PIDFD
WCONTINUED
WEXITED
WSTOPPED
WUNTRACED
WNOHANG
WNOWAIT
CLD_EXITED
CLD_KILLED
CLD_DUMPED
CLD_TRAPPED
CLD_STOPPED
CLD_CONTINUED
waitstatus_to_exitcode()
WCOREDUMP()
WIFCONTINUED()
WIFSTOPPED()
WIFSIGNALED()
WIFEXITED()
WEXITSTATUS()
WSTOPSIG()
WTERMSIG()
- Interface to the scheduler
SCHED_OTHER
SCHED_BATCH
SCHED_IDLE
SCHED_SPORADIC
SCHED_FIFO
SCHED_RR
SCHED_RESET_ON_FORK
sched_param
sched_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
— Core tools for working with streamstime
— Time access and conversions- Functions
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_time
time()
time_ns()
thread_time()
thread_time_ns()
tzset()
- Clock ID Constants
- Timezone Constants
- Functions
argparse
— Parser for command-line options, arguments and sub-commands- Core Functionality
- Quick Links for add_argument()
- Example
- ArgumentParser objects
- The add_argument() method
- The parse_args() method
- Other utilities
- Upgrading optparse code
getopt
— C-style parser for command line optionslogging
— Logging facility for Python- Logger Objects
Logger
Logger.propagate
Logger.setLevel()
Logger.isEnabledFor()
Logger.getEffectiveLevel()
Logger.getChild()
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 Objects
- LogRecord attributes
- LoggerAdapter Objects
- Thread Safety
- Module-Level Functions
- Module-Level Attributes
- Integration with the warnings module
- Logger Objects
logging.config
— Logging configurationlogging.handlers
— Logging handlersgetpass
— Portable password inputcurses
— Terminal handling for character-cell displays- Functions
error
baudrate()
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.encoding
window.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
- Functions
curses.textpad
— Text input widget for curses programscurses.ascii
— Utilities for ASCII characterscurses.panel
— A panel stack extension for cursesplatform
— Access to underlying platform’s identifying dataerrno
— Standard errno system symbolserrorcode
EPERM
ENOENT
ESRCH
EINTR
EIO
ENXIO
E2BIG
ENOEXEC
EBADF
ECHILD
EAGAIN
ENOMEM
EACCES
EFAULT
ENOTBLK
EBUSY
EEXIST
EXDEV
ENODEV
ENOTDIR
EISDIR
EINVAL
ENFILE
EMFILE
ENOTTY
ETXTBSY
EFBIG
ENOSPC
ESPIPE
EROFS
EMLINK
EPIPE
EDOM
ERANGE
EDEADLK
ENAMETOOLONG
ENOLCK
ENOSYS
ENOTEMPTY
ELOOP
EWOULDBLOCK
ENOMSG
EIDRM
ECHRNG
EL2NSYNC
EL3HLT
EL3RST
ELNRNG
EUNATCH
ENOCSI
EL2HLT
EBADE
EBADR
EXFULL
ENOANO
EBADRQC
EBADSLT
EDEADLOCK
EBFONT
ENOSTR
ENODATA
ETIME
ENOSR
ENONET
ENOPKG
EREMOTE
ENOLINK
EADV
ESRMNT
ECOMM
EPROTO
EMULTIHOP
EDOTDOT
EBADMSG
EOVERFLOW
ENOTUNIQ
EBADFD
EREMCHG
ELIBACC
ELIBBAD
ELIBSCN
ELIBMAX
ELIBEXEC
EILSEQ
ERESTART
ESTRPIPE
EUSERS
ENOTSOCK
EDESTADDRREQ
EMSGSIZE
EPROTOTYPE
ENOPROTOOPT
EPROTONOSUPPORT
ESOCKTNOSUPPORT
EOPNOTSUPP
EPFNOSUPPORT
EAFNOSUPPORT
EADDRINUSE
EADDRNOTAVAIL
ENETDOWN
ENETUNREACH
ENETRESET
ECONNABORTED
ECONNRESET
ENOBUFS
EISCONN
ENOTCONN
ESHUTDOWN
ETOOMANYREFS
ETIMEDOUT
ECONNREFUSED
EHOSTDOWN
EHOSTUNREACH
EALREADY
EINPROGRESS
ESTALE
EUCLEAN
ENOTNAM
ENAVAIL
EISNAM
EREMOTEIO
EDQUOT
EQFULL
ENOTCAPABLE
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 varadic 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()
gettrace()
setprofile()
getprofile()
stack_size()
TIMEOUT_MAX
- Thread-Local Data
- Thread Objects
- Lock Objects
- RLock Objects
- Condition Objects
- Semaphore Objects
- Event Objects
- Timer Objects
- Barrier Objects
- Using locks, conditions, and semaphores in the
with
statement
multiprocessing
— Process-based parallelism- Introduction
- Reference
Process
and exceptions- Pipes and Queues
- Miscellaneous
- Connection Objects
- Synchronization primitives
- Shared
ctypes
Objects - Managers
- Proxy Objects
- Process Pools
- Listeners and Clients
- Authentication keys
- Logging
- The
multiprocessing.dummy
module
- Programming guidelines
- Examples
multiprocessing.shared_memory
— Shared memory for direct access across processes- The
concurrent
package concurrent.futures
— Launching parallel taskssubprocess
— Subprocess management- Using the
subprocess
Module - Security Considerations
- Popen Objects
- Windows Popen Helpers
STARTUPINFO
- Windows Constants
STD_INPUT_HANDLE
STD_OUTPUT_HANDLE
STD_ERROR_HANDLE
SW_HIDE
STARTF_USESTDHANDLES
STARTF_USESHOWWINDOW
CREATE_NEW_CONSOLE
CREATE_NEW_PROCESS_GROUP
ABOVE_NORMAL_PRIORITY_CLASS
BELOW_NORMAL_PRIORITY_CLASS
HIGH_PRIORITY_CLASS
IDLE_PRIORITY_CLASS
NORMAL_PRIORITY_CLASS
REALTIME_PRIORITY_CLASS
CREATE_NO_WINDOW
DETACHED_PROCESS
CREATE_DEFAULT_ERROR_MODE
CREATE_BREAKAWAY_FROM_JOB
- Older high-level API
- Replacing Older Functions with the
subprocess
Module - Legacy Shell Invocation Functions
- Notes
- Using the
sched
— Event schedulerqueue
— A synchronized queue classcontextvars
— Context Variables_thread
— Low-level threading API
- Networking and Interprocess Communication
asyncio
— Asynchronous I/O- Runners
- Coroutines and Tasks
- Streams
- Synchronization Primitives
- Subprocesses
- Creating Subprocesses
- Constants
- Interacting with Subprocesses
asyncio.subprocess.Process
asyncio.subprocess.Process.wait()
asyncio.subprocess.Process.communicate()
asyncio.subprocess.Process.send_signal()
asyncio.subprocess.Process.terminate()
asyncio.subprocess.Process.kill()
asyncio.subprocess.Process.stdin
asyncio.subprocess.Process.stdout
asyncio.subprocess.Process.stderr
asyncio.subprocess.Process.pid
asyncio.subprocess.Process.returncode
- Subprocess and Threads
- Examples
- Queues
- Exceptions
- 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
- Examples
- Futures
- Transports and Protocols
- Policies
- Getting and Setting the Policy
- Policy Objects
- Process Watchers
- Custom Policies
- Platform Support
- Extending
- High-level API Index
- Low-level API Index
- Developing with asyncio
socket
— Low-level networking interface- Socket families
- Module contents
- Exceptions
- Constants
AF_UNIX
AF_INET
AF_INET6
SOCK_STREAM
SOCK_DGRAM
SOCK_RAW
SOCK_RDM
SOCK_SEQPACKET
SOCK_CLOEXEC
SOCK_NONBLOCK
SOMAXCONN
AF_CAN
PF_CAN
CAN_BCM
CAN_RAW_FD_FRAMES
CAN_RAW_JOIN_FILTERS
CAN_ISOTP
CAN_J1939
AF_PACKET
PF_PACKET
AF_RDS
PF_RDS
SOL_RDS
SIO_RCVALL
SIO_KEEPALIVE_VALS
SIO_LOOPBACK_FAST_PATH
AF_ALG
SOL_ALG
AF_VSOCK
IOCTL_VM_SOCKETS_GET_LOCAL_CID
AF_LINK
has_ipv6
BDADDR_ANY
BDADDR_LOCAL
HCI_FILTER
HCI_TIME_STAMP
HCI_DATA_DIR
AF_QIPCRTR
SCM_CREDS2
LOCAL_CREDS
LOCAL_CREDS_PERSISTENT
SO_INCOMING_CPU
- Functions
- Creating sockets
- Other functions
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 Objects
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.family
socket.type
socket.proto
- Notes on socket timeouts
- Example
ssl
— TLS/SSL wrapper for socket objects- Functions, Constants, and Exceptions
- Socket creation
- Context creation
- Exceptions
- Random generation
- Certificate handling
- Constants
CERT_NONE
CERT_OPTIONAL
CERT_REQUIRED
VerifyMode
VERIFY_DEFAULT
VERIFY_CRL_CHECK_LEAF
VERIFY_CRL_CHECK_CHAIN
VERIFY_X509_STRICT
VERIFY_ALLOW_PROXY_CERTS
VERIFY_X509_TRUSTED_FIRST
VERIFY_X509_PARTIAL_CHAIN
VerifyFlags
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_SSLv23
PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2
OP_ALL
OP_NO_SSLv2
OP_NO_SSLv3
OP_NO_TLSv1
OP_NO_TLSv1_1
OP_NO_TLSv1_2
OP_NO_TLSv1_3
OP_NO_RENEGOTIATION
OP_CIPHER_SERVER_PREFERENCE
OP_SINGLE_DH_USE
OP_SINGLE_ECDH_USE
OP_ENABLE_MIDDLEBOX_COMPAT
OP_NO_COMPRESSION
Options
OP_NO_TICKET
OP_IGNORE_UNEXPECTED_EOF
HAS_ALPN
HAS_NEVER_CHECK_COMMON_NAME
HAS_ECDH
HAS_SNI
HAS_NPN
HAS_SSLv2
HAS_SSLv3
HAS_TLSv1
HAS_TLSv1_1
HAS_TLSv1_2
HAS_TLSv1_3
CHANNEL_BINDING_TYPES
OPENSSL_VERSION
OPENSSL_VERSION_INFO
OPENSSL_VERSION_NUMBER
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_INTERNAL_ERROR
AlertDescription
Purpose.SERVER_AUTH
Purpose.CLIENT_AUTH
SSLErrorNumber
TLSVersion
- SSL Sockets
SSLSocket
SSLSocket.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.context
SSLSocket.server_side
SSLSocket.server_hostname
SSLSocket.session
SSLSocket.session_reused
- SSL Contexts
SSLContext
SSLContext.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_callback
SSLContext.set_servername_callback
SSLContext.load_dh_params()
SSLContext.set_ecdh_curve()
SSLContext.wrap_socket()
SSLContext.sslsocket_class
SSLContext.wrap_bio()
SSLContext.sslobject_class
SSLContext.session_stats()
SSLContext.check_hostname
SSLContext.keylog_filename
SSLContext.maximum_version
SSLContext.minimum_version
SSLContext.num_tickets
SSLContext.options
SSLContext.post_handshake_auth
SSLContext.protocol
SSLContext.hostname_checks_common_name
SSLContext.security_level
SSLContext.verify_flags
SSLContext.verify_mode
- Certificates
- Examples
- Notes on non-blocking sockets
- Memory BIO Support
- SSL session
- Security considerations
- TLS 1.3
- Functions, Constants, and Exceptions
select
— Waiting for I/O completionselectors
— High-level I/O multiplexingsignal
— Set handlers for asynchronous events- General rules
- Module contents
Signals
Handlers
Sigmasks
SIG_DFL
SIG_IGN
SIGABRT
SIGALRM
SIGBREAK
SIGBUS
SIGCHLD
SIGCLD
SIGCONT
SIGFPE
SIGHUP
SIGILL
SIGINT
SIGKILL
SIGPIPE
SIGSEGV
SIGSTKFLT
SIGTERM
SIGUSR1
SIGUSR2
SIGWINCH
CTRL_C_EVENT
CTRL_BREAK_EVENT
NSIG
ITIMER_REAL
ITIMER_VIRTUAL
ITIMER_PROF
SIG_BLOCK
SIG_UNBLOCK
SIG_SETMASK
ItimerError
alarm()
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()
- Examples
- Note on SIGPIPE
- Note on Signal Handlers and Exceptions
mmap
— Memory-mapped file supportmmap
- MADV_* Constants
MADV_NORMAL
MADV_RANDOM
MADV_SEQUENTIAL
MADV_WILLNEED
MADV_DONTNEED
MADV_REMOVE
MADV_DONTFORK
MADV_DOFORK
MADV_HWPOISON
MADV_MERGEABLE
MADV_UNMERGEABLE
MADV_SOFT_OFFLINE
MADV_HUGEPAGE
MADV_NOHUGEPAGE
MADV_DONTDUMP
MADV_DODUMP
MADV_FREE
MADV_NOSYNC
MADV_AUTOSYNC
MADV_NOCORE
MADV_CORE
MADV_PROTECT
MADV_FREE_REUSABLE
MADV_FREE_REUSE
- MAP_* Constants
- Internet Data Handling
email
— An email and MIME handling packageemail.message
: Representing an email messageEmailMessage
EmailMessage.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.preamble
EmailMessage.epilogue
EmailMessage.defects
MIMEPart
email.parser
: Parsing email messagesemail.generator
: Generating MIME documentsemail.policy
: Policy ObjectsPolicy
Policy.max_line_length
Policy.linesep
Policy.cte_type
Policy.raise_on_defect
Policy.mangle_from_
Policy.message_factory
Policy.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()
EmailPolicy
default
SMTP
SMTPUTF8
HTTP
strict
Compat32
compat32
email.errors
: Exception and Defect classesemail.headerregistry
: Custom Header Objectsemail.contentmanager
: Managing MIME Contentemail
: Examplesemail.message.Message
: Representing an email message using thecompat32
APIMessage
Message.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.preamble
Message.epilogue
Message.defects
email.mime
: Creating email and MIME objects from scratchemail.header
: Internationalized headersemail.charset
: Representing character setsCharset
Charset.input_charset
Charset.header_encoding
Charset.body_encoding
Charset.output_charset
Charset.input_codec
Charset.output_codec
Charset.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 encoder and decodermailbox
— Manipulate mailboxes in various formatsMailbox
objectsMailbox
Mailbox.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()
Maildir
mbox
MH
Babyl
MMDF
Message
objects- Exceptions
- Examples
mimetypes
— Map filenames to MIME typesbase64
— Base16, Base32, Base64, Base85 Data Encodingsb64encode()
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
— Encode and decode MIME quoted-printable data
- Structured Markup Processing Tools
html
— HyperText Markup Language supporthtml.parser
— Simple HTML and XHTML parserHTMLParser
- Example HTML Parser Application
HTMLParser
MethodsHTMLParser.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()
- Examples
html.entities
— Definitions of HTML general entities- XML Processing Modules
xml.etree.ElementTree
— The ElementTree XML API- Tutorial
- XPath support
- Reference
- XInclude support
- Reference
- Functions
- Element Objects
Element
Element.tag
Element.text
Element.tail
Element.attrib
Element.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 Objects
- QName Objects
- TreeBuilder Objects
- XMLParser Objects
- XMLPullParser Objects
- Exceptions
xml.dom
— The Document Object Model API- Module Contents
- Objects in the DOM
- DOMImplementation Objects
- Node Objects
Node.nodeType
Node.parentNode
Node.attributes
Node.previousSibling
Node.nextSibling
Node.childNodes
Node.firstChild
Node.lastChild
Node.localName
Node.prefix
Node.namespaceURI
Node.nodeName
Node.nodeValue
Node.hasAttributes()
Node.hasChildNodes()
Node.isSameNode()
Node.appendChild()
Node.insertBefore()
Node.removeChild()
Node.replaceChild()
Node.normalize()
Node.cloneNode()
- NodeList Objects
- DocumentType Objects
- Document Objects
- Element Objects
Element.tagName
Element.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 Objects
- Comment Objects
- Text and CDATASection Objects
- ProcessingInstruction Objects
- Exceptions
- 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 handlersContentHandler
DTDHandler
EntityResolver
ErrorHandler
LexicalHandler
feature_namespaces
feature_namespace_prefixes
feature_string_interning
feature_validation
feature_external_ges
feature_external_pes
all_features
property_lexical_handler
property_declaration_handler
property_dom_node
property_xml_string
all_properties
- ContentHandler Objects
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 Objects
- EntityResolver Objects
- ErrorHandler Objects
- LexicalHandler Objects
xml.sax.saxutils
— SAX Utilitiesxml.sax.xmlreader
— Interface for XML parsersXMLReader
IncrementalParser
Locator
InputSource
AttributesImpl
AttributesNSImpl
- XMLReader Objects
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 Objects
- Locator Objects
- InputSource Objects
- The
Attributes
Interface - The
AttributesNS
Interface
xml.parsers.expat
— Fast XML parsing using ExpatExpatError
error
XMLParserType
ErrorString()
ParserCreate()
- XMLParser Objects
xmlparser.Parse()
xmlparser.ParseFile()
xmlparser.SetBase()
xmlparser.GetBase()
xmlparser.GetInputContext()
xmlparser.ExternalEntityParserCreate()
xmlparser.SetParamEntityParsing()
xmlparser.UseForeignDTD()
xmlparser.buffer_size
xmlparser.buffer_text
xmlparser.buffer_used
xmlparser.ordered_attributes
xmlparser.specified_attributes
xmlparser.ErrorByteIndex
xmlparser.ErrorCode
xmlparser.ErrorColumnNumber
xmlparser.ErrorLineNumber
xmlparser.CurrentByteIndex
xmlparser.CurrentColumnNumber
xmlparser.CurrentLineNumber
xmlparser.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 Exceptions
- Example
- Content Model Descriptions
- Expat error constants
codes
messages
XML_ERROR_ASYNC_ENTITY
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF
XML_ERROR_BAD_CHAR_REF
XML_ERROR_BINARY_ENTITY_REF
XML_ERROR_DUPLICATE_ATTRIBUTE
XML_ERROR_INCORRECT_ENCODING
XML_ERROR_INVALID_TOKEN
XML_ERROR_JUNK_AFTER_DOC_ELEMENT
XML_ERROR_MISPLACED_XML_PI
XML_ERROR_NO_ELEMENTS
XML_ERROR_NO_MEMORY
XML_ERROR_PARAM_ENTITY_REF
XML_ERROR_PARTIAL_CHAR
XML_ERROR_RECURSIVE_ENTITY_REF
XML_ERROR_SYNTAX
XML_ERROR_TAG_MISMATCH
XML_ERROR_UNCLOSED_TOKEN
XML_ERROR_UNDEFINED_ENTITY
XML_ERROR_UNKNOWN_ENCODING
XML_ERROR_UNCLOSED_CDATA_SECTION
XML_ERROR_EXTERNAL_ENTITY_HANDLING
XML_ERROR_NOT_STANDALONE
XML_ERROR_UNEXPECTED_STATE
XML_ERROR_ENTITY_DECLARED_IN_PE
XML_ERROR_FEATURE_REQUIRES_XML_DTD
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
XML_ERROR_UNBOUND_PREFIX
XML_ERROR_UNDECLARING_PREFIX
XML_ERROR_INCOMPLETE_PE
XML_ERROR_XML_DECL
XML_ERROR_TEXT_DECL
XML_ERROR_PUBLICID
XML_ERROR_SUSPENDED
XML_ERROR_NOT_SUSPENDED
XML_ERROR_ABORTED
XML_ERROR_FINISHED
XML_ERROR_SUSPEND_PE
XML_ERROR_RESERVED_PREFIX_XML
XML_ERROR_RESERVED_PREFIX_XMLNS
XML_ERROR_RESERVED_NAMESPACE_URI
XML_ERROR_INVALID_ARGUMENT
XML_ERROR_NO_BUFFER
XML_ERROR_AMPLIFICATION_LIMIT_BREACH
- Internet Protocols and Support
webbrowser
— Convenient web-browser controllerwsgiref
— WSGI Utilities and Reference Implementationwsgiref.util
– WSGI environment utilitieswsgiref.headers
– WSGI response header toolswsgiref.simple_server
– a simple WSGI HTTP serverwsgiref.validate
— WSGI conformance checkerwsgiref.handlers
– server/gateway base classesCGIHandler
IISCGIHandler
BaseCGIHandler
SimpleHandler
BaseHandler
BaseHandler.run()
BaseHandler._write()
BaseHandler._flush()
BaseHandler.get_stdin()
BaseHandler.get_stderr()
BaseHandler.add_cgi_vars()
BaseHandler.wsgi_multithread
BaseHandler.wsgi_multiprocess
BaseHandler.wsgi_run_once
BaseHandler.os_environ
BaseHandler.server_software
BaseHandler.get_scheme()
BaseHandler.setup_environ()
BaseHandler.log_exception()
BaseHandler.traceback_limit
BaseHandler.error_output()
BaseHandler.error_status
BaseHandler.error_headers
BaseHandler.error_body
BaseHandler.wsgi_file_wrapper
BaseHandler.sendfile()
BaseHandler.origin_server
BaseHandler.http_version
read_environ()
wsgiref.types
– WSGI types for static type checking- Examples
urllib
— URL handling modulesurllib.request
— Extensible library for opening URLsurlopen()
install_opener()
build_opener()
pathname2url()
url2pathname()
getproxies()
Request
OpenerDirector
BaseHandler
HTTPDefaultErrorHandler
HTTPRedirectHandler
HTTPCookieProcessor
ProxyHandler
HTTPPasswordMgr
HTTPPasswordMgrWithDefaultRealm
HTTPPasswordMgrWithPriorAuth
AbstractBasicAuthHandler
HTTPBasicAuthHandler
ProxyBasicAuthHandler
AbstractDigestAuthHandler
HTTPDigestAuthHandler
ProxyDigestAuthHandler
HTTPHandler
HTTPSHandler
FileHandler
DataHandler
FTPHandler
CacheFTPHandler
UnknownHandler
HTTPErrorProcessor
- Request Objects
Request.full_url
Request.type
Request.host
Request.origin_req_host
Request.selector
Request.data
Request.unverifiable
Request.method
Request.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 Objects
- BaseHandler Objects
- HTTPRedirectHandler Objects
- HTTPCookieProcessor Objects
- ProxyHandler Objects
- HTTPPasswordMgr Objects
- HTTPPasswordMgrWithPriorAuth Objects
- AbstractBasicAuthHandler Objects
- HTTPBasicAuthHandler Objects
- ProxyBasicAuthHandler Objects
- AbstractDigestAuthHandler Objects
- HTTPDigestAuthHandler Objects
- ProxyDigestAuthHandler Objects
- HTTPHandler Objects
- HTTPSHandler Objects
- FileHandler Objects
- DataHandler Objects
- FTPHandler Objects
- CacheFTPHandler Objects
- UnknownHandler Objects
- HTTPErrorProcessor Objects
- Examples
- Legacy interface
urllib.request
Restrictions
urllib.response
— Response classes used by urlliburllib.parse
— Parse URLs into componentsurllib.error
— Exception classes raised by urllib.requesturllib.robotparser
— Parser for robots.txthttp
— HTTP moduleshttp.client
— HTTP protocol clientHTTPConnection
HTTPSConnection
HTTPResponse
parse_headers()
HTTPException
NotConnected
InvalidURL
UnknownProtocol
UnknownTransferEncoding
UnimplementedFileMode
IncompleteRead
ImproperConnectionState
CannotSendRequest
CannotSendHeader
ResponseNotReady
BadStatusLine
LineTooLong
RemoteDisconnected
HTTP_PORT
HTTPS_PORT
responses
- HTTPConnection Objects
- HTTPResponse Objects
HTTPResponse.read()
HTTPResponse.readinto()
HTTPResponse.getheader()
HTTPResponse.getheaders()
HTTPResponse.fileno()
HTTPResponse.msg
HTTPResponse.version
HTTPResponse.url
HTTPResponse.headers
HTTPResponse.status
HTTPResponse.reason
HTTPResponse.debuglevel
HTTPResponse.closed
HTTPResponse.geturl()
HTTPResponse.info()
HTTPResponse.getstatus()
- Examples
- HTTPMessage Objects
ftplib
— FTP protocol clientFTP
FTP_TLS
error_reply
error_temp
error_perm
error_proto
all_errors
- FTP Objects
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 Objects
poplib
— POP3 protocol clientimaplib
— IMAP4 protocol clientIMAP4
IMAP4_SSL
IMAP4_stream
Internaldate2tuple()
Int2AP()
ParseFlags()
Time2Internaldate()
- IMAP4 Objects
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_VERSION
IMAP4.debug
IMAP4.utf8_enabled
- IMAP4 Example
smtplib
— SMTP protocol clientuuid
— UUID objects according to RFC 4122socketserver
— A framework for network serversTCPServer
UDPServer
UnixStreamServer
UnixDatagramServer
- Server Creation Notes
- Server Objects
BaseServer
BaseServer.fileno()
BaseServer.handle_request()
BaseServer.serve_forever()
BaseServer.service_actions()
BaseServer.shutdown()
BaseServer.server_close()
BaseServer.address_family
BaseServer.RequestHandlerClass
BaseServer.server_address
BaseServer.socket
BaseServer.allow_reuse_address
BaseServer.request_queue_size
BaseServer.socket_type
BaseServer.timeout
BaseServer.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
- Examples
http.server
— HTTP serversHTTPServer
ThreadingHTTPServer
BaseHTTPRequestHandler
BaseHTTPRequestHandler.client_address
BaseHTTPRequestHandler.server
BaseHTTPRequestHandler.close_connection
BaseHTTPRequestHandler.requestline
BaseHTTPRequestHandler.command
BaseHTTPRequestHandler.path
BaseHTTPRequestHandler.request_version
BaseHTTPRequestHandler.headers
BaseHTTPRequestHandler.rfile
BaseHTTPRequestHandler.wfile
BaseHTTPRequestHandler.server_version
BaseHTTPRequestHandler.sys_version
BaseHTTPRequestHandler.error_message_format
BaseHTTPRequestHandler.error_content_type
BaseHTTPRequestHandler.protocol_version
BaseHTTPRequestHandler.MessageClass
BaseHTTPRequestHandler.responses
BaseHTTPRequestHandler.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()
SimpleHTTPRequestHandler
CGIHTTPRequestHandler
- Security Considerations
http.cookies
— HTTP state managementhttp.cookiejar
— Cookie handling for HTTP clientsLoadError
CookieJar
FileCookieJar
CookiePolicy
DefaultCookiePolicy
Cookie
- CookieJar and FileCookieJar Objects
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.filename
FileCookieJar.delayload
- FileCookieJar subclasses and co-operation with web browsers
- CookiePolicy Objects
- DefaultCookiePolicy Objects
DefaultCookiePolicy.blocked_domains()
DefaultCookiePolicy.set_blocked_domains()
DefaultCookiePolicy.is_blocked()
DefaultCookiePolicy.allowed_domains()
DefaultCookiePolicy.set_allowed_domains()
DefaultCookiePolicy.is_not_allowed()
DefaultCookiePolicy.rfc2109_as_netscape
DefaultCookiePolicy.strict_domain
DefaultCookiePolicy.strict_rfc2965_unverifiable
DefaultCookiePolicy.strict_ns_unverifiable
DefaultCookiePolicy.strict_ns_domain
DefaultCookiePolicy.strict_ns_set_initial_dollar
DefaultCookiePolicy.strict_ns_set_path
DefaultCookiePolicy.DomainStrictNoDots
DefaultCookiePolicy.DomainStrictNonDomain
DefaultCookiePolicy.DomainRFC2965Match
DefaultCookiePolicy.DomainLiberal
DefaultCookiePolicy.DomainStrict
- Cookie Objects
Cookie.version
Cookie.name
Cookie.value
Cookie.port
Cookie.path
Cookie.secure
Cookie.expires
Cookie.discard
Cookie.comment
Cookie.comment_url
Cookie.rfc2109
Cookie.port_specified
Cookie.domain_specified
Cookie.domain_initial_dot
Cookie.has_nonstandard_attr()
Cookie.get_nonstandard_attr()
Cookie.set_nonstandard_attr()
Cookie.is_expired()
- Examples
xmlrpc
— XMLRPC server and client modulesxmlrpc.client
— XML-RPC client accessxmlrpc.server
— Basic XML-RPC serversipaddress
— IPv4/IPv6 manipulation library- Convenience factory functions
- IP Addresses
- Address objects
IPv4Address
IPv4Address.version
IPv4Address.max_prefixlen
IPv4Address.compressed
IPv4Address.exploded
IPv4Address.packed
IPv4Address.reverse_pointer
IPv4Address.is_multicast
IPv4Address.is_private
IPv4Address.is_global
IPv4Address.is_unspecified
IPv4Address.is_reserved
IPv4Address.is_loopback
IPv4Address.is_link_local
IPv4Address.__format__()
IPv6Address
IPv6Address.compressed
IPv6Address.exploded
IPv6Address.packed
IPv6Address.reverse_pointer
IPv6Address.version
IPv6Address.max_prefixlen
IPv6Address.is_multicast
IPv6Address.is_private
IPv6Address.is_global
IPv6Address.is_unspecified
IPv6Address.is_reserved
IPv6Address.is_loopback
IPv6Address.is_link_local
IPv6Address.is_site_local
IPv6Address.ipv4_mapped
IPv6Address.scope_id
IPv6Address.sixtofour
IPv6Address.teredo
IPv6Address.__format__()
- Conversion to Strings and Integers
- Operators
- Address objects
- IP Network definitions
- Prefix, net mask and host mask
- Network objects
IPv4Network
IPv4Network.version
IPv4Network.max_prefixlen
IPv4Network.is_multicast
IPv4Network.is_private
IPv4Network.is_unspecified
IPv4Network.is_reserved
IPv4Network.is_loopback
IPv4Network.is_link_local
IPv4Network.network_address
IPv4Network.broadcast_address
IPv4Network.hostmask
IPv4Network.netmask
IPv4Network.with_prefixlen
IPv4Network.compressed
IPv4Network.exploded
IPv4Network.with_netmask
IPv4Network.with_hostmask
IPv4Network.num_addresses
IPv4Network.prefixlen
IPv4Network.hosts()
IPv4Network.overlaps()
IPv4Network.address_exclude()
IPv4Network.subnets()
IPv4Network.supernet()
IPv4Network.subnet_of()
IPv4Network.supernet_of()
IPv4Network.compare_networks()
IPv6Network
IPv6Network.version
IPv6Network.max_prefixlen
IPv6Network.is_multicast
IPv6Network.is_private
IPv6Network.is_unspecified
IPv6Network.is_reserved
IPv6Network.is_loopback
IPv6Network.is_link_local
IPv6Network.network_address
IPv6Network.broadcast_address
IPv6Network.hostmask
IPv6Network.netmask
IPv6Network.with_prefixlen
IPv6Network.compressed
IPv6Network.exploded
IPv6Network.with_netmask
IPv6Network.with_hostmask
IPv6Network.num_addresses
IPv6Network.prefixlen
IPv6Network.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
- Multimedia Services
wave
— Read and write WAV filesopen()
Error
- Wave_read Objects
Wave_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 Objects
colorsys
— Conversions between color systems
- Internationalization
gettext
— Multilingual internationalization serviceslocale
— Internationalization servicesError
setlocale()
localeconv()
nl_langinfo()
CODESET
D_T_FMT
D_FMT
T_FMT
T_FMT_AMPM
RADIXCHAR
THOUSEP
YESEXPR
NOEXPR
CRNCYSTR
ERA
ERA_D_T_FMT
ERA_D_FMT
ERA_T_FMT
ALT_DIGITS
getdefaultlocale()
getlocale()
getpreferredencoding()
getencoding()
normalize()
resetlocale()
strcoll()
strxfrm()
format_string()
format()
currency()
str()
delocalize()
localize()
atof()
atoi()
LC_CTYPE
LC_COLLATE
LC_TIME
LC_MONETARY
LC_MESSAGES
LC_NUMERIC
LC_ALL
CHAR_MAX
- Background, details, hints, tips and caveats
- For extension writers and programs that embed Python
- Access to message catalogs
- Program Frameworks
turtle
— Turtle graphics- Introduction
- Overview of available Turtle and Screen methods
- Methods of RawTurtle/Turtle and corresponding functions
- Methods of TurtleScreen/Screen and corresponding functions
- Public classes
- Help and configuration
turtledemo
— Demo scripts- Changes since Python 2.6
- Changes since Python 3.0
cmd
— Support for line-oriented command interpretersshlex
— Simple lexical analysissplit()
join()
quote()
shlex
- shlex Objects
shlex.get_token()
shlex.push_token()
shlex.read_token()
shlex.sourcehook()
shlex.push_source()
shlex.pop_source()
shlex.error_leader()
shlex.commenters
shlex.wordchars
shlex.whitespace
shlex.escape
shlex.quotes
shlex.escapedquotes
shlex.whitespace_split
shlex.infile
shlex.instream
shlex.source
shlex.debug
shlex.lineno
shlex.token
shlex.eof
shlex.punctuation_chars
- Parsing Rules
- Improved Compatibility with Shells
- Graphical User Interfaces with Tk
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()
Open
SaveAs
Directory
FileDialog
FileDialog.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()
LoadFileDialog
SaveFileDialog
- 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
- Options
- Item Options
- Tag Options
- Column Identifiers
- Virtual Events
- ttk.Treeview
Treeview
Treeview.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
— Extension widgets for Tk- IDLE
- Development Tools
typing
— Support for type hints- Relevant PEPs
- Type aliases
- NewType
- Callable
- Generics
- User-defined generic types
- The
Any
type - Nominal vs structural subtyping
- Module contents
- Special typing primitives
- Generic concrete collections
- Abstract Base Classes
- Protocols
- Functions and decorators
- Introspection helpers
- Constant
- Deprecation Timeline of Major Features
pydoc
— Documentation generator and online help system- Python Development Mode
- Effects of the Python Development Mode
- ResourceWarning Example
- Bad file descriptor error example
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
— Unit testing framework- Basic example
- 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
TestCase
TestCase.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.records
TestCase.output
TestCase.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.failureException
TestCase.longMessage
TestCase.maxDiff
TestCase.countTestCases()
TestCase.defaultTestResult()
TestCase.id()
TestCase.shortDescription()
TestCase.addCleanup()
TestCase.enterContext()
TestCase.doCleanups()
TestCase.addClassCleanup()
TestCase.enterClassContext()
TestCase.doClassCleanups()
IsolatedAsyncioTestCase
FunctionTestCase
- Deprecated aliases
- Grouping tests
- Loading and running tests
TestLoader
TestLoader.errors
TestLoader.loadTestsFromTestCase()
TestLoader.loadTestsFromModule()
TestLoader.loadTestsFromName()
TestLoader.loadTestsFromNames()
TestLoader.getTestCaseNames()
TestLoader.discover()
TestLoader.testMethodPrefix
TestLoader.sortTestMethodsUsing
TestLoader.suiteClass
TestLoader.testNamePatterns
TestResult
TestResult.errors
TestResult.failures
TestResult.skipped
TestResult.expectedFailures
TestResult.unexpectedSuccesses
TestResult.shouldStop
TestResult.testsRun
TestResult.buffer
TestResult.failfast
TestResult.tb_locals
TestResult.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()
TextTestResult
defaultTestLoader
TextTestRunner
main()
- load_tests Protocol
- Test cases
- Class and Module Fixtures
- Signal Handling
unittest.mock
— mock object library- Quick Guide
- The Mock Class
Mock
Mock.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.called
Mock.call_count
Mock.return_value
Mock.side_effect
Mock.call_args
Mock.call_args_list
Mock.method_calls
Mock.mock_calls
Mock.__class__
NonCallableMock
PropertyMock
AsyncMock
AsyncMock.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_count
AsyncMock.await_args
AsyncMock.await_args_list
- Calling
- Deleting Attributes
- Mock names and the name attribute
- Attaching Mocks as Attributes
- The patchers
- MagicMock and magic method support
- Helpers
unittest.mock
— getting started- Using Mock
- Mock Patching Methods
- Mock for Method Calls on an Object
- 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
- 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
- Using Mock
- 2to3 — Automated Python 2 to 3 code translation
test
— Regression tests package for Pythontest.support
— Utilities for the Python test suiteTestFailed
ResourceDenied
verbose
is_jython
is_android
unix_shell
LOOPBACK_TIMEOUT
INTERNET_TIMEOUT
SHORT_TIMEOUT
LONG_TIMEOUT
PGO
PIPE_MAX_SIZE
SOCK_MAX_SIZE
TEST_SUPPORT_DIR
TEST_HOME_DIR
TEST_DATA_DIR
MAX_Py_ssize_t
max_memuse
real_max_memuse
MISSING_C_DOCSTRINGS
HAVE_DOCSTRINGS
TEST_HTTP_URL
ALWAYS_EQ
NEVER_EQ
LARGEST
SMALLEST
is_resource_enabled()
python_is_optimized()
with_pymalloc()
requires()
sortdict()
findfile()
match_test()
set_match_tests()
run_unittest()
run_doctest()
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()
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()
SuppressCrashReport
SaveSignals
Matcher
BasicTestRunner
test.support.socket_helper
— Utilities for socket teststest.support.script_helper
— Utilities for the Python execution teststest.support.bytecode_helper
— Support tools for testing correct bytecode generationtest.support.threading_helper
— Utilities for threading teststest.support.os_helper
— Utilities for os testsFS_NONASCII
SAVEDCWD
TESTFN
TESTFN_NONASCII
TESTFN_UNENCODABLE
TESTFN_UNDECODABLE
TESTFN_UNICODE
EnvironmentVarGuard
FakePath
can_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
— Utilities for import teststest.support.warnings_helper
— Utilities for warnings tests
- Debugging and Profiling
- Audit events table
bdb
— Debugger frameworkBdbQuit
Breakpoint
Bdb
Bdb.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
— Measure execution time of small code snippetstrace
— Trace or track Python statement executiontracemalloc
— Trace memory allocations
- Software Packaging and Distribution
- Python Runtime Services
sys
— System-specific parameters and functionsabiflags
addaudithook()
argv
audit()
base_exec_prefix
base_prefix
byteorder
builtin_module_names
call_tracing()
copyright
_clear_type_cache()
_current_frames()
_current_exceptions()
breakpointhook()
_debugmallocstats()
dllhandle
displayhook()
dont_write_bytecode
_emscripten_info
pycache_prefix
excepthook()
__breakpointhook__
__displayhook__
__excepthook__
__unraisablehook__
exception()
exc_info()
exec_prefix
executable
exit()
flags
float_info
float_repr_style
getallocatedblocks()
getandroidapilevel()
getdefaultencoding()
getdlopenflags()
getfilesystemencoding()
getfilesystemencodeerrors()
get_int_max_str_digits()
getrefcount()
getrecursionlimit()
getsizeof()
getswitchinterval()
_getframe()
getprofile()
gettrace()
getwindowsversion()
get_asyncgen_hooks()
get_coroutine_origin_tracking_depth()
hash_info
hexversion
implementation
int_info
__interactivehook__
intern()
is_finalizing()
last_type
last_value
last_traceback
maxsize
maxunicode
meta_path
modules
orig_argv
path
path_hooks
path_importer_cache
platform
platlibdir
prefix
ps1
ps2
setdlopenflags()
set_int_max_str_digits()
setprofile()
setrecursionlimit()
setswitchinterval()
settrace()
set_asyncgen_hooks()
set_coroutine_origin_tracking_depth()
_enablelegacywindowsfsencoding()
stdin
stdout
stderr
__stdin__
__stdout__
__stderr__
stdlib_module_names
thread_info
tracebacklimit
unraisablehook()
version
api_version
version_info
warnoptions
winver
_xoptions
sysconfig
— Provide access to Python’s configuration informationbuiltins
— Built-in objects__main__
— Top-level code environmentwarnings
— Warning controldataclasses
— Data Classescontextlib
— Utilities forwith
-statement contexts- Utilities
- Examples and Recipes
- Single use, reusable and reentrant context managers
abc
— Abstract Base Classesatexit
— 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
ObjectsTracebackException
TracebackException.__cause__
TracebackException.__context__
TracebackException.__suppress_context__
TracebackException.__notes__
TracebackException.stack
TracebackException.exc_type
TracebackException.filename
TracebackException.lineno
TracebackException.text
TracebackException.offset
TracebackException.msg
TracebackException.from_exception()
TracebackException.print()
TracebackException.format()
TracebackException.format_exception_only()
StackSummary
ObjectsFrameSummary
Objects- Traceback Examples
__future__
— Future statement definitionsgc
— Garbage Collector interfaceenable()
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()
garbage
callbacks
DEBUG_STATS
DEBUG_COLLECTABLE
DEBUG_UNCOLLECTABLE
DEBUG_SAVEALL
DEBUG_LEAK
inspect
— Inspect live objects- Types and members
getmembers()
getmembers_static()
getmodulename()
ismodule()
isclass()
ismethod()
isfunction()
isgeneratorfunction()
isgenerator()
iscoroutinefunction()
iscoroutine()
isawaitable()
isasyncgenfunction()
isasyncgen()
istraceback()
isframe()
iscode()
isbuiltin()
ismethodwrapper()
isroutine()
isabstract()
ismethoddescriptor()
isdatadescriptor()
isgetsetdescriptor()
ismemberdescriptor()
- Retrieving source code
- Introspecting callables with the Signature object
- Classes and functions
- The interpreter stack
- Fetching attributes statically
- Current State of Generators and Coroutines
- Code Objects Bit Flags
- Command Line Interface
- Types and members
site
— Site-specific configuration hook
- Custom Python Interpreters
- Importing Modules
zipimport
— Import modules from Zip archivesZipImportError
- zipimporter Objects
zipimporter
zipimporter.create_module()
zipimporter.exec_module()
zipimporter.find_loader()
zipimporter.find_module()
zipimporter.find_spec()
zipimporter.get_code()
zipimporter.get_data()
zipimporter.get_filename()
zipimporter.get_source()
zipimporter.is_package()
zipimporter.load_module()
zipimporter.invalidate_caches()
zipimporter.archive
zipimporter.prefix
- Examples
pkgutil
— Package extension utilitymodulefinder
— Find modules used by a scriptrunpy
— Locating and executing Python modulesimportlib
— The implementation ofimport
- Introduction
- Functions
importlib.abc
– Abstract base classes related to importimportlib.machinery
– Importers and path hooksimportlib.util
– Utility code for importers- Examples
importlib.resources
– Resources- Deprecated functions
importlib.resources.abc
– Abstract base classes for resources- Using
importlib.metadata
- The initialization of the
sys.path
module search path
- Python Language Services
ast
— Abstract Syntax Trees- Abstract Grammar
- Node classes
AST
- Literals
- Variables
- Expressions
- Statements
- Control flow
- Pattern matching
- Function and class definitions
- Async and await
ast
Helpers- Compiler Flags
- Command-Line Usage
symtable
— Access to the compiler’s symbol tablestoken
— Constants used with Python parse treestok_name
ISTERMINAL()
ISNONTERMINAL()
ISEOF()
ENDMARKER
NAME
NUMBER
STRING
NEWLINE
INDENT
DEDENT
LPAR
RPAR
LSQB
RSQB
COLON
COMMA
SEMI
PLUS
MINUS
STAR
SLASH
VBAR
AMPER
LESS
GREATER
EQUAL
DOT
PERCENT
LBRACE
RBRACE
EQEQUAL
NOTEQUAL
LESSEQUAL
GREATEREQUAL
TILDE
CIRCUMFLEX
LEFTSHIFT
RIGHTSHIFT
DOUBLESTAR
PLUSEQUAL
MINEQUAL
STAREQUAL
SLASHEQUAL
PERCENTEQUAL
AMPEREQUAL
VBAREQUAL
CIRCUMFLEXEQUAL
LEFTSHIFTEQUAL
RIGHTSHIFTEQUAL
DOUBLESTAREQUAL
DOUBLESLASH
DOUBLESLASHEQUAL
AT
ATEQUAL
RARROW
ELLIPSIS
COLONEQUAL
OP
AWAIT
ASYNC
TYPE_IGNORE
TYPE_COMMENT
SOFT_KEYWORD
ERRORTOKEN
N_TOKENS
NT_OFFSET
COMMENT
NL
ENCODING
keyword
— Testing for Python keywordstokenize
— Tokenizer for Python sourcetabnanny
— Detection of ambiguous indentationpyclbr
— Python module browser supportpy_compile
— Compile Python source filescompileall
— Byte-compile Python librariesdis
— Disassembler for Python bytecodepickletools
— Tools for pickle developers
- MS Windows Specific Services
msvcrt
— Useful routines from the MS VC++ runtimewinreg
— Windows registry access- Functions
CloseKey()
ConnectRegistry()
CreateKey()
CreateKeyEx()
DeleteKey()
DeleteKeyEx()
DeleteValue()
EnumKey()
EnumValue()
ExpandEnvironmentStrings()
FlushKey()
LoadKey()
OpenKey()
OpenKeyEx()
QueryInfoKey()
QueryValue()
QueryValueEx()
SaveKey()
SetValue()
SetValueEx()
DisableReflectionKey()
EnableReflectionKey()
QueryReflectionKey()
- Constants
- Registry Handle Objects
- Functions
winsound
— Sound-playing interface for Windows
- Unix Specific Services
posix
— The most common POSIX system callspwd
— The password databasegrp
— The group databasetermios
— POSIX style tty controltty
— Terminal control functionspty
— Pseudo-terminal utilitiesfcntl
— Thefcntl
andioctl
system callsresource
— Resource usage informationerror
- Resource Limits
RLIM_INFINITY
getrlimit()
setrlimit()
prlimit()
RLIMIT_CORE
RLIMIT_CPU
RLIMIT_FSIZE
RLIMIT_DATA
RLIMIT_STACK
RLIMIT_RSS
RLIMIT_NPROC
RLIMIT_NOFILE
RLIMIT_OFILE
RLIMIT_MEMLOCK
RLIMIT_VMEM
RLIMIT_AS
RLIMIT_MSGQUEUE
RLIMIT_NICE
RLIMIT_RTPRIO
RLIMIT_RTTIME
RLIMIT_SIGPENDING
RLIMIT_SBSIZE
RLIMIT_SWAP
RLIMIT_NPTS
RLIMIT_KQUEUES
- Resource Usage
syslog
— Unix syslog library routines
- Superseded Modules
aifc
— Read and write AIFF and AIFC filesopen()
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()
asynchat
— Asynchronous socket command/response handlerasyncore
— Asynchronous socket handlerloop()
dispatcher
dispatcher.handle_read()
dispatcher.handle_write()
dispatcher.handle_expt()
dispatcher.handle_connect()
dispatcher.handle_close()
dispatcher.handle_error()
dispatcher.handle_accept()
dispatcher.handle_accepted()
dispatcher.readable()
dispatcher.writable()
dispatcher.create_socket()
dispatcher.connect()
dispatcher.send()
dispatcher.recv()
dispatcher.listen()
dispatcher.bind()
dispatcher.accept()
dispatcher.close()
dispatcher_with_send
file_dispatcher
file_wrapper
- asyncore Example basic HTTP client
- asyncore Example basic echo server
audioop
— Manipulate raw audio datacgi
— Common Gateway Interface supportcgitb
— Traceback manager for CGI scriptschunk
— Read IFF chunked datacrypt
— Function to check Unix passwordsimghdr
— Determine the type of an imageimp
— Access the import internalsmailcap
— Mailcap file handlingmsilib
— Read and write Microsoft Installer filesnis
— Interface to Sun’s NIS (Yellow Pages)nntplib
— NNTP protocol clientNNTP
NNTP_SSL
NNTPError
NNTPReplyError
NNTPTemporaryError
NNTPPermanentError
NNTPProtocolError
NNTPDataError
- NNTP Objects
- Attributes
- 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
ossaudiodev
— Access to OSS-compatible audio devicesOSSAudioError
open()
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.closed
oss_audio_device.name
oss_audio_device.mode
- Mixer Device Objects
pipes
— Interface to shell pipelinessmtpd
— SMTP Serversndhdr
— Determine type of sound filespwd
— The shadow password databasesunau
— Read and write Sun AU filesopen()
Error
AUDIO_FILE_MAGIC
AUDIO_FILE_ENCODING_MULAW_8
AUDIO_FILE_ENCODING_LINEAR_8
AUDIO_FILE_ENCODING_LINEAR_16
AUDIO_FILE_ENCODING_LINEAR_24
AUDIO_FILE_ENCODING_LINEAR_32
AUDIO_FILE_ENCODING_ALAW_8
AUDIO_FILE_ENCODING_FLOAT
AUDIO_FILE_ENCODING_DOUBLE
AUDIO_FILE_ENCODING_ADPCM_G721
AUDIO_FILE_ENCODING_ADPCM_G722
AUDIO_FILE_ENCODING_ADPCM_G723_3
AUDIO_FILE_ENCODING_ADPCM_G723_5
- AU_read Objects
- AU_write Objects
telnetlib
— Telnet clientTelnet
- 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 Example
uu
— Encode and decode uuencode filesxdrlib
— Encode and decode XDR dataPacker
Unpacker
- 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()
- Exceptions
- Security Considerations
- Extending and Embedding the Python Interpreter
- Recommended third party tools
- Creating extensions without third party tools
- 1. Extending Python with C or C++
- 1.1. A Simple Example
- 1.2. Intermezzo: Errors and Exceptions
- 1.3. Back to the Example
- 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. Building C and C++ Extensions
- 5. Building C and C++ Extensions on Windows
- 1. Extending Python with C or C++
- Embedding the CPython runtime in a larger application
- Python/C API Reference Manual
- Introduction
- C API Stability
- The Very High Level Layer
- Reference Counting
- Exception Handling
- Utilities
- Abstract Objects Layer
- Concrete Objects Layer
- Fundamental Objects
- Numeric Objects
- Sequence Objects
- Container Objects
- Function Objects
- Other Objects
- 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
- Memory Management
- Object Implementation Support
- Allocating Objects on the Heap
- Common Object Structures
- Type Objects
- Quick Reference
- PyTypeObject Definition
- PyObject Slots
- PyVarObject Slots
- PyTypeObject Slots
Py_TPFLAGS_HEAPTYPE
Py_TPFLAGS_BASETYPE
Py_TPFLAGS_READY
Py_TPFLAGS_READYING
Py_TPFLAGS_HAVE_GC
Py_TPFLAGS_DEFAULT
Py_TPFLAGS_METHOD_DESCRIPTOR
Py_TPFLAGS_LONG_SUBCLASS
Py_TPFLAGS_LIST_SUBCLASS
Py_TPFLAGS_TUPLE_SUBCLASS
Py_TPFLAGS_BYTES_SUBCLASS
Py_TPFLAGS_UNICODE_SUBCLASS
Py_TPFLAGS_DICT_SUBCLASS
Py_TPFLAGS_BASE_EXC_SUBCLASS
Py_TPFLAGS_TYPE_SUBCLASS
Py_TPFLAGS_HAVE_FINALIZE
Py_TPFLAGS_HAVE_VECTORCALL
Py_TPFLAGS_IMMUTABLETYPE
Py_TPFLAGS_DISALLOW_INSTANTIATION
Py_TPFLAGS_MAPPING
Py_TPFLAGS_SEQUENCE
- Static Types
- Heap Types
- Number Object Structures
- Mapping Object Structures
- Sequence Object Structures
- Buffer Object Structures
- Async Object Structures
- Slot Type typedefs
- Examples
- Supporting Cyclic Garbage Collection
- API and ABI Versioning
- Distributing Python Modules
- Installing Python Modules
- Python HOWTOs
- Porting Python 2 Code to Python 3
- The Short Explanation
- Details
- Drop support for Python 2.6 and older
- Make sure you specify the proper version support in your
setup.py
file - Have good test coverage
- Learn the differences between Python 2 & 3
- Update your code
- Prevent compatibility regressions
- Check which dependencies block your transition
- Update your
setup.py
file to denote Python 3 compatibility - Use continuous integration to stay compatible
- Consider using optional static type checking
- Porting Extension Modules to Python 3
- Curses Programming with Python
- Descriptor HowTo Guide
- Enum HOWTO
- Programmatic access to enumeration members and their attributes
- Duplicating enum members and values
- Ensuring unique enumeration values
- Using automatic values
- Iteration
- Comparisons
- Allowed members and attributes of enumerations
- Restricted Enum subclassing
- Pickling
- Functional API
- Derived Enumerations
- When to use
__new__()
vs.__init__()
- How are Enums and Flags different?
- Enum Cookbook
- Subclassing EnumType
- Functional Programming HOWTO
- Logging HOWTO
- 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
- Regular Expression HOWTO
- Socket Programming HOWTO
- Sorting HOW TO
- Unicode HOWTO
- HOWTO Fetch Internet Resources Using The urllib Package
- Argparse Tutorial
- An introduction to the ipaddress module
- Argument Clinic How-To
- The Goals Of Argument Clinic
- Basic Concepts And Usage
- Converting Your First Function
- Advanced Topics
- Symbolic default values
- Renaming the C functions and variables generated by Argument Clinic
- Converting functions using PyArg_UnpackTuple
- Optional Groups
- Using real Argument Clinic converters, instead of “legacy converters”
- Py_buffer
- Advanced converters
- Parameter default values
- The
NULL
default value - Expressions specified as default values
- Using a return converter
- Cloning existing functions
- Calling Python code
- Using a “self converter”
- Using a “defining class” converter
- Writing a custom converter
- Writing a custom return converter
- METH_O and METH_NOARGS
- tp_new and tp_init functions
- Changing and redirecting Clinic’s output
- The #ifdef trick
- Using Argument Clinic in Python files
- Instrumenting CPython with DTrace and SystemTap
- Annotations Best Practices
- Isolating Extension Modules
- Porting Python 2 Code to Python 3
- Python Frequently Asked Questions
- General Python FAQ
- Programming FAQ
- Design and History FAQ
- Why does Python use indentation for grouping of statements?
- Why am I getting strange results with simple arithmetic operations?
- Why are floating-point calculations so inaccurate?
- Why are Python strings immutable?
- Why must ‘self’ be used explicitly in method definitions and calls?
- Why can’t I use an assignment in an expression?
- Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?
- Why is join() a string method instead of a list or tuple method?
- How fast are exceptions?
- Why isn’t there a switch or case statement in Python?
- Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?
- Why can’t lambda expressions contain statements?
- Can Python be compiled to machine code, C or some other language?
- How does Python manage memory?
- Why doesn’t CPython use a more traditional garbage collection scheme?
- Why isn’t all memory freed when CPython exits?
- Why are there separate tuple and list data types?
- How are lists implemented in CPython?
- How are dictionaries implemented in CPython?
- Why must dictionary keys be immutable?
- Why doesn’t list.sort() return the sorted list?
- How do you specify and enforce an interface spec in Python?
- Why is there no goto?
- Why can’t raw strings (r-strings) end with a backslash?
- Why doesn’t Python have a “with” statement for attribute assignments?
- Why don’t generators support the with statement?
- Why are colons required for the if/while/def/class statements?
- Why does Python allow commas at the end of lists and tuples?
- Library and Extension FAQ
- Extending/Embedding FAQ
- Can I create my own functions in C?
- Can I create my own functions in C++?
- Writing C is hard; are there any alternatives?
- How can I execute arbitrary Python statements from C?
- How can I evaluate an arbitrary Python expression from C?
- How do I extract C values from a Python object?
- How do I use Py_BuildValue() to create a tuple of arbitrary length?
- How do I call an object’s method from C?
- How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?
- How do I access a module written in Python from C?
- How do I interface to C++ objects from Python?
- I added a module using the Setup file and the make fails; why?
- How do I debug an extension?
- I want to compile a Python module on my Linux system, but some files are missing. Why?
- How do I tell “incomplete input” from “invalid input”?
- How do I find undefined g++ symbols __builtin_new or __pure_virtual?
- Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?
- Python on Windows FAQ
- How do I run a Python program under Windows?
- How do I make Python scripts executable?
- Why does Python sometimes take so long to start?
- How do I make an executable from a Python script?
- Is a
*.pyd
file the same as a DLL? - How can I embed Python into a Windows application?
- How do I keep editors from inserting tabs into my Python source?
- How do I check for a keypress without blocking?
- How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?
- Graphic User Interface FAQ
- “Why is Python Installed on my Computer?” FAQ
- Glossary
- About these documents
- Dealing with Bugs
- Copyright
- History and License