Python Documentation contents¶
- What’s New in Python
- What’s New In Python 3.0
- What’s New in Python 2.7
- 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, Improved, and Deprecated Modules
- 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
- The Python Tutorial
- Whetting Your Appetite
- Using the Python Interpreter
- An Informal Introduction to Python
- More Control Flow Tools
- Data Structures
- Modules
- Input and Output
- Errors and Exceptions
- Classes
- Brief Tour of the Standard Library
- Brief Tour of the Standard Library – Part II
- What Now?
- Interactive Input Editing and History Substitution
- Floating Point Arithmetic: Issues and Limitations
- Using Python
- The Python Language Reference
- Introduction
- Lexical analysis
- Data model
- Execution model
- Expressions
- Simple statements
- Compound statements
- Top-level components
- Full Grammar specification
- The Python Standard Library
- Introduction
- Built-in Functions
- Built-in Constants
- Built-in Objects
- Built-in Types
- Truth Value Testing
- Boolean Operations — and, or, not
- Comparisons
- Numeric Types — int, float, complex
- Iterator Types
- Sequence Types — str, bytes, bytearray, list, tuple, range
- Set Types — set, frozenset
- Mapping Types — dict
- File Objects
- memoryview Types
- Context Manager Types
- Other Built-in Types
- Special Attributes
- Built-in Exceptions
- String Services
- string — Common string operations
- re — Regular expression operations
- struct — Interpret bytes as packed binary data
- difflib — Helpers for computing deltas
- textwrap — Text wrapping and filling
- codecs — Codec registry and base classes
- unicodedata — Unicode Database
- stringprep — Internet String Preparation
- Data Types
- datetime — Basic date and time types
- calendar — General calendar-related functions
- collections — Container datatypes
- heapq — Heap queue algorithm
- bisect — Array bisection algorithm
- array — Efficient arrays of numeric values
- sched — Event scheduler
- queue — A synchronized queue class
- weakref — Weak references
- types — Names for built-in types
- copy — Shallow and deep copy operations
- pprint — Data pretty printer
- reprlib — Alternate repr() implementation
- Numeric and Mathematical Modules
- numbers — Numeric abstract base classes
- math — Mathematical functions
- Constants
- cmath — Mathematical functions for complex numbers
- decimal — Decimal fixed point and floating point arithmetic
- fractions — Rational numbers
- random — Generate pseudo-random numbers
- itertools — Functions creating iterators for efficient looping
- functools — Higher order functions and operations on callable objects
- operator — Standard operators as functions
- File and Directory Access
- os.path — Common pathname manipulations
- fileinput — Iterate over lines from multiple input streams
- stat — Interpreting stat() results
- filecmp — File and Directory Comparisons
- tempfile — Generate temporary files and directories
- glob — Unix style pathname pattern expansion
- fnmatch — Unix filename pattern matching
- linecache — Random access to text lines
- shutil — High-level file operations
- macpath — Mac OS 9 path manipulation functions
- Data Persistence
- pickle — Python object serialization
- copyreg — Register pickle support functions
- shelve — Python object persistence
- marshal — Internal Python object serialization
- dbm — Interfaces to Unix “databases”
- sqlite3 — DB-API 2.0 interface for SQLite databases
- Data Compression and Archiving
- File Formats
- Cryptographic Services
- Generic Operating System Services
- os — Miscellaneous operating system interfaces
- io — Core tools for working with streams
- time — Time access and conversions
- optparse — More powerful command line option parser
- 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
- getopt — Parser for command line options
- logging — Logging facility for Python
- Logging tutorial
- Logging Levels
- Useful Handlers
- Module-Level Functions
- Logger Objects
- Basic example
- Logging to multiple destinations
- Adding contextual information to your logging output
- Sending and receiving logging events across a network
- Handler Objects
- Formatter Objects
- Filter Objects
- LogRecord Objects
- LoggerAdapter Objects
- Thread Safety
- Configuration
- More examples
- getpass — Portable password input
- curses — Terminal handling for character-cell displays
- curses.textpad — Text input widget for curses programs
- curses.wrapper — Terminal handler for curses programs
- curses.ascii — Utilities for ASCII characters
- curses.panel — A panel stack extension for curses.
- platform — Access to underlying platform’s identifying data.
- errno — Standard errno system symbols
- 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 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
- ctypes tutorial
- Optional Operating System Services
- select — Waiting for I/O completion
- threading — Higher-level threading interface
- dummy_threading — Drop-in replacement for the threading module
- _thread — Low-level threading API
- _dummy_thread — Drop-in replacement for the _thread module
- multiprocessing — Process-based “threading” interface
- mmap — Memory-mapped file support
- readline — GNU readline interface
- rlcompleter — Completion function for GNU readline
- Interprocess Communication and Networking
- Internet Data Handling
- email — An email and MIME handling package
- email: Representing an email message
- email: Parsing email messages
- email: Generating MIME documents
- email: Creating email and MIME objects from scratch
- email: Internationalized headers
- email: Representing character sets
- email: Encoders
- email: Exception and Defect classes
- email: Miscellaneous utilities
- email: Iterators
- email: Examples
- Package History
- Differences from mimelib
- json — JSON encoder and decoder
- mailcap — Mailcap file handling
- mailbox — Manipulate mailboxes in various formats
- mimetypes — Map filenames to MIME types
- base64 — RFC 3548: Base16, Base32, Base64 Data Encodings
- binhex — Encode and decode binhex4 files
- binascii — Convert between binary and ASCII
- quopri — Encode and decode MIME quoted-printable data
- uu — Encode and decode uuencode files
- email — An email and MIME handling package
- Structured Markup Processing Tools
- html.parser — Simple HTML and XHTML parser
- html.entities — Definitions of HTML general entities
- xml.parsers.expat — Fast XML parsing using Expat
- xml.dom — The Document Object Model API
- xml.dom.minidom — Lightweight DOM implementation
- xml.dom.pulldom — Support for building partial DOM trees
- xml.sax — Support for SAX2 parsers
- xml.sax.handler — Base classes for SAX handlers
- xml.sax.saxutils — SAX Utilities
- xml.sax.xmlreader — Interface for XML parsers
- xml.etree.ElementTree — The ElementTree XML API
- Internet Protocols and Support
- webbrowser — Convenient Web-browser controller
- cgi — Common Gateway Interface support.
- cgitb — Traceback manager for CGI scripts
- wsgiref — WSGI Utilities and Reference Implementation
- urllib.request — extensible library for opening URLs
- Request Objects
- OpenerDirector Objects
- BaseHandler Objects
- HTTPRedirectHandler Objects
- HTTPCookieProcessor Objects
- ProxyHandler Objects
- HTTPPasswordMgr Objects
- AbstractBasicAuthHandler Objects
- HTTPBasicAuthHandler Objects
- ProxyBasicAuthHandler Objects
- AbstractDigestAuthHandler Objects
- HTTPDigestAuthHandler Objects
- ProxyDigestAuthHandler Objects
- HTTPHandler Objects
- HTTPSHandler Objects
- FileHandler Objects
- FTPHandler Objects
- CacheFTPHandler Objects
- UnknownHandler Objects
- HTTPErrorProcessor Objects
- Examples
- urllib.request Restrictions
- urllib.response — Response classes used by urllib.
- urllib.parse — Parse URLs into components
- urllib.error — Exception classes raised by urllib.request
- urllib.robotparser — Parser for robots.txt
- http.client — HTTP protocol client
- ftplib — FTP protocol client
- poplib — POP3 protocol client
- imaplib — IMAP4 protocol client
- nntplib — NNTP protocol client
- smtplib — SMTP protocol client
- smtpd — SMTP Server
- telnetlib — Telnet client
- uuid — UUID objects according to RFC 4122
- socketserver — A framework for network servers
- http.server — HTTP servers
- http.cookies — HTTP state management
- http.cookiejar — Cookie handling for HTTP clients
- xmlrpc.client — XML-RPC client access
- xmlrpc.server — Basic XML-RPC servers
- Multimedia Services
- audioop — Manipulate raw audio data
- aifc — Read and write AIFF and AIFC files
- sunau — Read and write Sun AU files
- wave — Read and write WAV files
- chunk — Read IFF chunked data
- colorsys — Conversions between color systems
- imghdr — Determine the type of an image
- sndhdr — Determine type of sound file
- ossaudiodev — Access to OSS-compatible audio devices
- Internationalization
- Program Frameworks
- Graphical User Interfaces with Tk
- tkinter — Python interface to Tcl/Tk
- tkinter.tix — Extension widgets for Tk
- tkinter.scrolledtext — Scrolled Text Widget
- turtle — Turtle graphics for Tk
- IDLE
- Other Graphical User Interface Packages
- Development Tools
- pydoc — Documentation generator and online help system
- doctest — Test interactive Python examples
- unittest — Unit testing framework
- 2to3 - Automated Python 2 to 3 code translation
- test — Regression tests package for Python
- test.support — Utility functions for tests
- Debugging and Profiling
- Python Runtime Services
- sys — System-specific parameters and functions
- builtins — Built-in objects
- __main__ — Top-level script environment
- warnings — Warning control
- contextlib — Utilities for with-statement contexts.
- abc — Abstract Base Classes
- atexit — Exit handlers
- traceback — Print or retrieve a stack traceback
- __future__ — Future statement definitions
- gc — Garbage Collector interface
- inspect — Inspect live objects
- site — Site-specific configuration hook
- fpectl — Floating point exception control
- Custom Python Interpreters
- Importing Modules
- Python Language Services
- parser — Access Python parse trees
- Abstract Syntax Trees
- symtable — Access to the compiler’s symbol tables
- symbol — Constants used with Python parse trees
- token — Constants used with Python parse trees
- keyword — Testing for Python keywords
- tokenize — Tokenizer for Python source
- tabnanny — Detection of ambiguous indentation
- pyclbr — Python class browser support
- py_compile — Compile Python source files
- compileall — Byte-compile Python libraries
- dis — Disassembler for Python bytecode
- pickletools — Tools for pickle developers.
- distutils — Building and installing Python modules
- Miscellaneous Services
- MS Windows Specific Services
- Unix Specific Services
- posix — The most common POSIX system calls
- pwd — The password database
- spwd — The shadow password database
- grp — The group database
- crypt — Function to check Unix passwords
- termios — POSIX style tty control
- tty — Terminal control functions
- pty — Pseudo-terminal utilities
- fcntl — The fcntl() and ioctl() system calls
- pipes — Interface to shell pipelines
- resource — Resource usage information
- nis — Interface to Sun’s NIS (Yellow Pages)
- syslog — Unix syslog library routines
- Undocumented Modules
- Extending and Embedding the Python Interpreter
- Extending Python with C or C++
- A Simple Example
- Intermezzo: Errors and Exceptions
- Back to the Example
- The Module’s Method Table and Initialization Function
- Compilation and Linkage
- Calling Python Functions from C
- Extracting Parameters in Extension Functions
- Keyword Parameters for Extension Functions
- Building Arbitrary Values
- Reference Counts
- Writing Extensions in C++
- Providing a C API for an Extension Module
- Defining New Types
- Building C and C++ Extensions with distutils
- Building C and C++ Extensions on Windows
- Embedding Python in Another Application
- Extending Python with C or C++
- Python/C API Reference Manual
- Introduction
- The Very High Level Layer
- Reference Counting
- Exception Handling
- Utilities
- Abstract Objects Layer
- Concrete Objects Layer
- Initialization, Finalization, and Threads
- Memory Management
- Object Implementation Support
- Distributing Python Modules
- An Introduction to Distutils
- Writing the Setup Script
- Writing the Setup Configuration File
- Creating a Source Distribution
- Creating Built Distributions
- Registering with the Package Index
- Uploading Packages to the Package Index
- Examples
- Extending Distutils
- Command Reference
- API Reference
- distutils.core — Core Distutils functionality
- distutils.ccompiler — CCompiler base class
- distutils.unixccompiler — Unix C Compiler
- distutils.msvccompiler — Microsoft Compiler
- distutils.bcppcompiler — Borland Compiler
- distutils.cygwincompiler — Cygwin Compiler
- distutils.emxccompiler — OS/2 EMX Compiler
- distutils.mwerkscompiler — Metrowerks CodeWarrior support
- distutils.archive_util — Archiving utilities
- distutils.dep_util — Dependency checking
- distutils.dir_util — Directory tree operations
- distutils.file_util — Single file operations
- distutils.util — Miscellaneous other utility functions
- distutils.dist — The Distribution class
- distutils.extension — The Extension class
- distutils.debug — Distutils debug mode
- distutils.errors — Distutils exceptions
- distutils.fancy_getopt — Wrapper around the standard getopt module
- distutils.filelist — The FileList class
- distutils.log — Simple PEP 282-style logging
- distutils.spawn — Spawn a sub-process
- distutils.sysconfig — System configuration information
- distutils.text_file — The TextFile class
- distutils.version — Version number classes
- distutils.cmd — Abstract base class for Distutils commands
- distutils.command — Individual Distutils commands
- distutils.command.bdist — Build a binary installer
- distutils.command.bdist_packager — Abstract base class for packagers
- distutils.command.bdist_dumb — Build a “dumb” installer
- distutils.command.bdist_msi — Build a Microsoft Installer binary package
- distutils.command.bdist_rpm — Build a binary distribution as a Redhat RPM and SRPM
- distutils.command.bdist_wininst — Build a Windows installer
- distutils.command.sdist — Build a source distribution
- distutils.command.build — Build all files of a package
- distutils.command.build_clib — Build any C libraries in a package
- distutils.command.build_ext — Build any extensions in a package
- distutils.command.build_py — Build the .py/.pyc files of a package
- distutils.command.build_scripts — Build the scripts of a package
- distutils.command.clean — Clean a package build area
- distutils.command.config — Perform package configuration
- distutils.command.install — Install a package
- distutils.command.install_data — Install data files from a package
- distutils.command.install_headers — Install C/C++ header files from a package
- distutils.command.install_lib — Install library files from a package
- distutils.command.install_scripts — Install script files from a package
- distutils.command.register — Register a module with the Python Package Index
- Creating a new Distutils command
- Installing Python Modules
- Documenting Python
- Python HOWTOs
- Python Advocacy HOWTO
- Porting Extension Modules to 3.0
- Curses Programming with Python
- Idioms and Anti-Idioms in Python
- Functional Programming HOWTO
- Regular Expression HOWTO
- Socket Programming HOWTO
- Unicode HOWTO
- HOWTO Fetch Internet Resources Using The urllib Package
- HOWTO Use Python in the web
- Glossary
- About these documents
- Reporting Bugs in Python
- Copyright
- History and License
