Search
Searching for multiple words only shows matches that contain all words.
Search Results
Search finished, found 290 pages matching the search query.
- asyncio.Future.__init__ (Python method, in Extending)
- asyncio.Task.__init__ (Python method, in Extending)
- difflib.HtmlDiff.__init__ (Python method, in
difflib
— Helpers for computing deltas) - enum.Enum.__init__ (Python method, in
enum
— Support for enumerations) - logging.Handler.__init__ (Python method, in
logging
— Logging facility for Python) - logging.logging.Formatter.__init__ (Python method, in Logging HOWTO)
- object.__init__ (Python method, in 3. Data model)
__main__
— Top-level code environment__main__ — Top-level code environment In Python, the special name __main__ is used for two important constructs: the name of the top-level environment of the program, which can be checked using the __name__ == '__main__'...
dataclasses
— Data Classesdataclasses — Data Classes Source code: Lib/dataclasses.py This module provides a decorator and functions for automatically adding generated special methods such as __init__() and __repr__() to user-defined classes. It wa...
- Debugging C API extensions and CPython Internals with GDB
Debugging C API extensions and CPython Internals with GDB This document explains how the Python GDB extension, python-gdb.py, can be used with the GDB debugger to debug CPython extensions and the CPython interpreter itself....
- Enum HOWTO
...their value: >>> Weekday.WEDNESDAY.value 3 Unlike many languages that treat enumerations solely as name/value pairs, Python Enums can have behavior added. For example, datetime.date has two methods for returning the weekday: weekday() a...
- Library and Extension FAQ
...nd Extension FAQ General Library Questions How do I find a module or application to perform task X? Where is the math.py (socket.py, regex.py, etc.) source file? How do I make a Python script executable on Unix? Is there a curses/termcap...
- What’s New In Python 3.11
What’s New In Python 3.11 Editor: Pablo Galindo Salgado This article explains the new features in Python 3.11, compared to 3.10. Python 3.11 was released on October 24, 2022. For full details, see the changelog. Summary...
__future__
— Future statement definitions__future__ — Future statement definitions Source code: Lib/__future__.py Imports of the form from __future__ import feature are called future statements. These are special-cased by the Python compiler to allow the use of n...
abc
— Abstract Base Classesabc — Abstract Base Classes Source code: Lib/abc.py This module provides the infrastructure for defining abstract base classes (ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python. (See a...
argparse
— Parser for command-line options, arguments and subcommands...argparse — Parser for command-line options, arguments and subcommands Added in version 3.2. Source code: Lib/argparse.py Note While argparse is the default recommended standard library module for implementing basic command line applicati...
ast
— Abstract Syntax Treesast — Abstract Syntax Trees Source code: Lib/ast.py The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this m...
base64
— Base16, Base32, Base64, Base85 Data Encodingsbase64 — Base16, Base32, Base64, Base85 Data Encodings Source code: Lib/base64.py This module provides functions for encoding binary data to printable ASCII characters and decoding such encodings back to binary data. It pr...
bdb
— Debugger frameworkbdb — Debugger framework Source code: Lib/bdb.py The bdb module handles basic debugger functions, like setting breakpoints or managing execution via the debugger. The following exception is defined: exception bdb.BdbQuit...
bisect
— Array bisection algorithmbisect — Array bisection algorithm Source code: Lib/bisect.py This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. For long lists of items with expensiv...
builtins
— Built-in objectsbuiltins — Built-in objects This module provides direct access to all ‘built-in’ identifiers of Python; for example, builtins.open is the full name for the built-in function open(). This module is not normally accessed exp...
bz2
— Support for bzip2 compressionbz2 — Support for bzip2 compression Source code: Lib/bz2.py This module provides a comprehensive interface for compressing and decompressing data using the bzip2 compression algorithm. The bz2 module contains: The open()...
calendar
— General calendar-related functionscalendar — General calendar-related functions Source code: Lib/calendar.py This module allows you to output calendars like the Unix cal program, and provides additional useful functions related to the calendar. By default,...
cmd
— Support for line-oriented command interpreterscmd — Support for line-oriented command interpreters Source code: Lib/cmd.py The Cmd class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrat...
code
— Interpreter base classescode — Interpreter base classes Source code: Lib/code.py The code module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build appl...
codecs
— Codec registry and base classescodecs — Codec registry and base classes Source code: Lib/codecs.py This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manag...
codeop
— Compile Python codecodeop — Compile Python code Source code: Lib/codeop.py The codeop module provides utilities upon which the Python read-eval-print loop can be emulated, as is done in the code module. As a result, you probably don’t want...
collections.abc
— Abstract Base Classes for Containers...ers Added in version 3.3: Formerly, this module was part of the collections module. Source code: Lib/_collections_abc.py This module provides abstract base classes that can be used to test whether a class provides a particular interface;...
collections
— Container datatypescollections — Container datatypes Source code: Lib/collections/__init__.py This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and...
colorsys
— Conversions between color systemscolorsys — Conversions between color systems Source code: Lib/colorsys.py The colorsys module defines bidirectional conversions of color values between colors expressed in the RGB (Red Green Blue) color space used in compu...
compileall
— Byte-compile Python librariescompileall — Byte-compile Python libraries Source code: Lib/compileall.py This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree...
concurrent.futures
— Launching parallel tasks...concurrent.futures — Launching parallel tasks Added in version 3.2. Source code: Lib/concurrent/futures/thread.py and Lib/concurrent/futures/process.py The concurrent.futures module provides a high-level interface for asynchronous...
configparser
— Configuration file parserconfigparser — Configuration file parser Source code: Lib/configparser.py This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what’s found in Mi...
contextlib
— Utilities forwith
-statement contextscontextlib — Utilities for with-statement contexts Source code: Lib/contextlib.py This module provides utilities for common tasks involving the with statement. For more information see also Context Manager Types and With S...
copy
— Shallow and deep copy operationscopy — Shallow and deep copy operations Source code: Lib/copy.py Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable...
copyreg
— Registerpickle
support functionscopyreg — Register pickle support functions Source code: Lib/copyreg.py The copyreg module offers a way to define functions used while pickling specific objects. The pickle and copy modules use those functions when pickli...
csv
— CSV File Reading and Writingcsv — CSV File Reading and Writing Source code: Lib/csv.py The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years p...
ctypes
— A foreign function library for Pythonctypes — A foreign function library for Python Source code: Lib/ctypes ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It ca...
curses.ascii
— Utilities for ASCII characterscurses.ascii — Utilities for ASCII characters Source code: Lib/curses/ascii.py The curses.ascii module supplies name constants for ASCII characters and functions to test membership in various ASCII character classes. The...
datetime
— Basic date and time typesdatetime — Basic date and time types Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on ef...
dbm
— Interfaces to Unix “databases”dbm — Interfaces to Unix “databases” Source code: Lib/dbm/__init__.py dbm is a generic interface to variants of the DBM database: dbm.sqlite3 dbm.gnu dbm.ndbm If none of these modules are installed, the slow-but-simple i...
decimal
— Decimal fixed-point and floating-point arithmeticdecimal — Decimal fixed-point and floating-point arithmetic Source code: Lib/decimal.py The decimal module provides support for fast correctly rounded decimal floating-point arithmetic. It offers several advantages over th...
difflib
— Helpers for computing deltasdifflib — Helpers for computing deltas Source code: Lib/difflib.py This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce information about file...
dis
— Disassembler for Python bytecodedis — Disassembler for Python bytecode Source code: Lib/dis.py The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file I...
doctest
— Test interactive Python examplesdoctest — Test interactive Python examples Source code: Lib/doctest.py The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work ex...
email.charset
: Representing character setsemail.charset: Representing character sets Source code: Lib/email/charset.py This module is part of the legacy (Compat32) email API. In the new API only the aliases table is used. The remaining text in this section is the...
email.contentmanager
: Managing MIME Contentemail.contentmanager: Managing MIME Content Source code: Lib/email/contentmanager.py Added in version 3.6: [1] class email.contentmanager.ContentManager Base class for content managers. Provides the standard registry...
email.encoders
: Encodersemail.encoders: Encoders Source code: Lib/email/encoders.py This module is part of the legacy (Compat32) email API. In the new API the functionality is provided by the cte parameter of the set_content() method. This modul...
email.errors
: Exception and Defect classesemail.errors: Exception and Defect classes Source code: Lib/email/errors.py The following exception classes are defined in the email.errors module: exception email.errors.MessageError This is the base class for all excep...
email.generator
: Generating MIME documentsemail.generator: Generating MIME documents Source code: Lib/email/generator.py One of the most common tasks is to generate the flat (serialized) version of the email message represented by a message object structure. You...
email.header
: Internationalized headersemail.header: Internationalized headers Source code: Lib/email/header.py This module is part of the legacy (Compat32) email API. In the current API encoding and decoding of headers is handled transparently by the dictiona...
email.headerregistry
: Custom Header Objectsemail.headerregistry: Custom Header Objects Source code: Lib/email/headerregistry.py Added in version 3.6: [1] Headers are represented by customized subclasses of str. The particular class used to represent a given head...
email.iterators
: Iteratorsemail.iterators: Iterators Source code: Lib/email/iterators.py Iterating over a message object tree is fairly easy with the Message.walk method. The email.iterators module provides some useful higher level iterations over...
email.message
: Representing an email messageemail.message: Representing an email message Source code: Lib/email/message.py Added in version 3.6: [1] The central class in the email package is the EmailMessage class, imported from the email.message module. It is th...
email.parser
: Parsing email messagesemail.parser: Parsing email messages Source code: Lib/email/parser.py Message object structures can be created in one of two ways: they can be created from whole cloth by creating an EmailMessage object, adding headers usi...
email.policy
: Policy Objectsemail.policy: Policy Objects Added in version 3.3. Source code: Lib/email/policy.py The email package’s prime focus is the handling of email messages as described by the various email and MIME RFCs. However, the general...
email.utils
: Miscellaneous utilitiesemail.utils: Miscellaneous utilities Source code: Lib/email/utils.py There are a couple of useful utilities provided in the email.utils module: email.utils.localtime(dt=None) Return local time as an aware datetime object...
email
— An email and MIME handling packageemail — An email and MIME handling package Source code: Lib/email/__init__.py The email package is a library for managing email messages. It is specifically not designed to do any sending of email messages to SMTP (RFC 28...
enum
— Support for enumerationsenum — Support for enumerations Added in version 3.4. Source code: Lib/enum.py Important This page contains the API reference information. For tutorial information and discussion of more advanced topics, see Basic Tutor...
faulthandler
— Dump the Python tracebackfaulthandler — Dump the Python traceback Added in version 3.3. This module contains functions to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. Call faulthandler.enable() to install...
filecmp
— File and Directory Comparisonsfilecmp — File and Directory Comparisons Source code: Lib/filecmp.py The filecmp module defines functions to compare files and directories, with various optional time/correctness trade-offs. For comparing files, see also t...
fileinput
— Iterate over lines from multiple input streamsfileinput — Iterate over lines from multiple input streams Source code: Lib/fileinput.py This module implements a helper class and functions to quickly write a loop over standard input or a list of files. If you just want...
fnmatch
— Unix filename pattern matchingfnmatch — Unix filename pattern matching Source code: Lib/fnmatch.py This module provides support for Unix shell-style wildcards, which are not the same as regular expressions (which are documented in the re module). The...
fractions
— Rational numbersfractions — Rational numbers Source code: Lib/fractions.py The fractions module provides support for rational number arithmetic. A Fraction instance can be constructed from a pair of integers, from another rational number,...
ftplib
— FTP protocol clientftplib — FTP protocol client Source code: Lib/ftplib.py This module defines the class FTP and a few related items. The FTP class implements the client side of the FTP protocol. You can use this to write Python programs th...
functools
— Higher-order functions and operations on callable objectsfunctools — Higher-order functions and operations on callable objects Source code: Lib/functools.py The functools module is for higher-order functions: functions that act on or return other functions. In general, any calla...
getopt
— C-style parser for command line optionsgetopt — C-style parser for command line options Source code: Lib/getopt.py Note This module is considered feature complete. A more declarative and extensible alternative to this API is provided in the optparse module. Fur...
getpass
— Portable password inputgetpass — Portable password input Source code: Lib/getpass.py Availability: not WASI. This module does not work or is not available on WebAssembly. See WebAssembly platforms for more information. The getpass module provi...
gettext
— Multilingual internationalization servicesgettext — Multilingual internationalization services Source code: Lib/gettext.py The gettext module provides internationalization (I18N) and localization (L10N) services for your Python modules and applications. It support...
glob
— Unix style pathname pattern expansionglob — Unix style pathname pattern expansion Source code: Lib/glob.py The glob module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell, although results are returned in arb...
graphlib
— Functionality to operate with graph-like structuresgraphlib — Functionality to operate with graph-like structures Source code: Lib/graphlib.py class graphlib.TopologicalSorter(graph=None) Provides functionality to topologically sort a graph of hashable nodes. A topologic...
gzip
— Support for gzip filesgzip — Support for gzip files Source code: Lib/gzip.py This module provides a simple interface to compress and decompress files just like the GNU programs gzip and gunzip would. The data compression is provided by the zlib...
hashlib
— Secure hashes and message digestshashlib — Secure hashes and message digests Source code: Lib/hashlib.py This module implements a common interface to many different secure hash and message digest algorithms. Included are the FIPS secure hash algorithms S...
heapq
— Heap queue algorithmheapq — Heap queue algorithm Source code: Lib/heapq.py This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. Heaps are binary trees for which every parent node has...
hmac
— Keyed-Hashing for Message Authenticationhmac — Keyed-Hashing for Message Authentication Source code: Lib/hmac.py This module implements the HMAC algorithm as described by RFC 2104. hmac.new(key, msg=None, digestmod) Return a new hmac object. key is a bytes or...
html.entities
— Definitions of HTML general entitieshtml.entities — Definitions of HTML general entities Source code: Lib/html/entities.py This module defines four dictionaries, html5, name2codepoint, codepoint2name, and entitydefs. html.entities.html5 A dictionary that m...
html.parser
— Simple HTML and XHTML parserhtml.parser — Simple HTML and XHTML parser Source code: Lib/html/parser.py This module defines a class HTMLParser which serves as the basis for parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML....
html
— HyperText Markup Language supporthtml — HyperText Markup Language support Source code: Lib/html/__init__.py This module defines utilities to manipulate HTML. html.escape(s, quote=True) Convert the characters &, < and > in string s to HTML-safe sequences...
http.client
— HTTP protocol clienthttp.client — HTTP protocol client Source code: Lib/http/client.py This module defines classes that implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the module urllib.request u...
http.cookiejar
— Cookie handling for HTTP clientshttp.cookiejar — Cookie handling for HTTP clients Source code: Lib/http/cookiejar.py The http.cookiejar module defines classes for automatic handling of HTTP cookies. It is useful for accessing web sites that require smal...
http.cookies
— HTTP state managementhttp.cookies — HTTP state management Source code: Lib/http/cookies.py The http.cookies module defines classes for abstracting the concept of cookies, an HTTP state management mechanism. It supports both simple string-only...
http.server
— HTTP servershttp.server — HTTP servers Source code: Lib/http/server.py This module defines classes for implementing HTTP servers. Warning http.server is not recommended for production. It only implements basic security checks. Avai...
http
— HTTP moduleshttp — HTTP modules Source code: Lib/http/__init__.py http is a package that collects several modules for working with the HyperText Transfer Protocol: http.client is a low-level HTTP protocol client; for high-level URL o...
imaplib
— IMAP4 protocol clientimaplib — IMAP4 protocol client Source code: Lib/imaplib.py This module defines three classes, IMAP4, IMAP4_SSL and IMAP4_stream, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4r...
importlib.metadata
– Accessing package metadata.... Changed in version 3.10: importlib.metadata is no longer provisional. Source code: Lib/importlib/metadata/__init__.py importlib.metadata is a library that provides access to the metadata of an installed Distribution Package, such as it...
importlib.resources.abc
– Abstract base classes for resourcesimportlib.resources.abc – Abstract base classes for resources Source code: Lib/importlib/resources/abc.py Added in version 3.11. class importlib.resources.abc.ResourceReader Superseded by TraversableResources An abstra...
importlib.resources
– Package resource reading, opening and access...importlib.resources – Package resource reading, opening and access Source code: Lib/importlib/resources/__init__.py Added in version 3.7. This module leverages Python’s import system to provide access to resources within packages....
importlib
— The implementation ofimport
importlib — The implementation of import Added in version 3.1. Source code: Lib/importlib/__init__.py Introduction The purpose of the importlib package is three-fold. One is to provide the implementation of the import s...
inspect
— Inspect live objectsinspect — Inspect live objects Source code: Lib/inspect.py The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame obj...
io
— Core tools for working with streamsio — Core tools for working with streams Source code: Lib/io.py Overview The io module provides Python’s main facilities for dealing with various types of I/O. There are three main types of I/O: text I/O, binary I/O and...
ipaddress
— IPv4/IPv6 manipulation libraryipaddress — IPv4/IPv6 manipulation library Source code: Lib/ipaddress.py ipaddress provides the capabilities to create, manipulate and operate on IPv4 and IPv6 addresses and networks. The functions and classes in this modu...
itertools
— Functions creating iterators for efficient looping...terator building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a form suitable for Python. The module standardizes a core set of fast, memory efficient tools that are useful by themselves or in combinati...
json
— JSON encoder and decoderjson — JSON encoder and decoder Source code: Lib/json/__init__.py JSON (JavaScript Object Notation), specified by RFC 7159 (which obsoletes RFC 4627) and by ECMA-404, is a lightweight data interchange format inspired by Ja...
keyword
— Testing for Python keywordskeyword — Testing for Python keywords Source code: Lib/keyword.py This module allows a Python program to determine if a string is a keyword or soft keyword. keyword.iskeyword(s) Return True if s is a Python keyword....
linecache
— Random access to text lineslinecache — Random access to text lines Source code: Lib/linecache.py The linecache module allows one to get any line from a Python source file, while attempting to optimize internally, using a cache, the common case where...
locale
— Internationalization serviceslocale — Internationalization services Source code: Lib/locale.py The locale module opens access to the POSIX locale database and functionality. The POSIX locale mechanism allows programmers to deal with certain cultural i...
logging.config
— Logging configurationlogging.config — Logging configuration Source code: Lib/logging/config.py Important This page contains only reference information. For tutorials, please see Basic Tutorial Advanced Tutorial Logging Cookbook This sectio...
logging.handlers
— Logging handlerslogging.handlers — Logging handlers Source code: Lib/logging/handlers.py Important This page contains only reference information. For tutorials, please see Basic Tutorial Advanced Tutorial Logging Cookbook The followin...
logging
— Logging facility for Pythonlogging — Logging facility for Python Source code: Lib/logging/__init__.py Important This page contains the API reference information. For tutorial information and discussion of more advanced topics, see Basic Tutorial Ad...
lzma
— Compression using the LZMA algorithmlzma — Compression using the LZMA algorithm Added in version 3.3. Source code: Lib/lzma.py This module provides classes and convenience functions for compressing and decompressing data using the LZMA compression algorith...
mailbox
— Manipulate mailboxes in various formatsmailbox — Manipulate mailboxes in various formats Source code: Lib/mailbox.py This module defines two classes, Mailbox and Message, for accessing and manipulating on-disk mailboxes and the messages they contain. Mailbox of...
mimetypes
— Map filenames to MIME typesmimetypes — Map filenames to MIME types Source code: Lib/mimetypes.py The mimetypes module converts between a filename or URL and the MIME type associated with the filename extension. Conversions are provided from filenam...
modulefinder
— Find modules used by a scriptmodulefinder — Find modules used by a script Source code: Lib/modulefinder.py This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run...
multiprocessing.shared_memory
— Shared memory for direct access across processes...cessing.shared_memory — Shared memory for direct access across processes Source code: Lib/multiprocessing/shared_memory.py Added in version 3.8. This module provides a class, SharedMemory, for the allocation and management of shared memo...
multiprocessing
— Process-based parallelism...ltiprocessing supports three ways to start a process. These start methods are spawnThe parent process starts a fresh Python interpreter process. The child process will only inherit those resources necessary to run the process object’s r...
netrc
— netrc file processingnetrc — netrc file processing Source code: Lib/netrc.py The netrc class parses and encapsulates the netrc file format used by the Unix ftp program and other FTP clients. class netrc.netrc([file]) A netrc instance or subc...
numbers
— Numeric abstract base classesnumbers — Numeric abstract base classes Source code: Lib/numbers.py The numbers module (PEP 3141) defines a hierarchy of numeric abstract base classes which progressively define more operations. None of the types defined...
operator
— Standard operators as functionsoperator — Standard operators as functions Source code: Lib/operator.py The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equiv...
optparse
— Parser for command line optionsoptparse — Parser for command line options Source code: Lib/optparse.py Choosing an argument parsing library The standard library includes three argument parsing libraries: getopt: a module that closely mirrors the proce...
os.path
— Common pathname manipulationsos.path — Common pathname manipulations Source code: Lib/genericpath.py, Lib/posixpath.py (for POSIX) and Lib/ntpath.py (for Windows). This module implements some useful functions on pathnames. To read or write files see o...
os
— Miscellaneous operating system interfacesos — Miscellaneous operating system interfaces Source code: Lib/os.py This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open(), if you want...
pathlib
— Object-oriented filesystem paths...('.') >>> [x for x in p.iterdir() if x.is_dir()] [PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'), PosixPath('__pycache__'), PosixPath('build')] Listing Python source files in this directory tree: >>> list(p.glob('**/*.py')) [Posi...
pdb
— The Python Debuggerpdb — The Python Debugger Source code: Lib/pdb.py The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level,...
pickle
— Python object serializationpickle — Python object serialization Source code: Lib/pickle.py The pickle module implements binary protocols for serializing and de-serializing a Python object structure. “Pickling” is the process whereby a Python object...
pickletools
— Tools for pickle developerspickletools — Tools for pickle developers Source code: Lib/pickletools.py This module contains various constants relating to the intimate details of the pickle module, some lengthy comments about the implementation, and a...
pkgutil
— Package extension utilitypkgutil — Package extension utility Source code: Lib/pkgutil.py This module provides utilities for the import system, in particular package support. class pkgutil.ModuleInfo(module_finder, name, ispkg) A namedtuple that...
platform
— Access to underlying platform’s identifying dataplatform — Access to underlying platform’s identifying data Source code: Lib/platform.py Note Specific platforms listed alphabetically, with Linux included in the Unix section. Cross Platform platform.architecture(ex...
plistlib
— Generate and parse Apple.plist
filesplistlib — Generate and parse Apple .plist files Source code: Lib/plistlib.py This module provides an interface for reading and writing the “property list” files used by Apple, primarily on macOS and iOS. This module suppo...
poplib
— POP3 protocol clientpoplib — POP3 protocol client Source code: Lib/poplib.py This module defines a class, POP3, which encapsulates a connection to a POP3 server and implements the protocol as defined in RFC 1939. The POP3 class supports both...
pprint
— Data pretty printerpprint — Data pretty printer Source code: Lib/pprint.py The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the interpreter. If the formatted s...
pty
— Pseudo-terminal utilitiespty — Pseudo-terminal utilities Source code: Lib/pty.py The pty module defines operations for handling the pseudo-terminal concept: starting another process and being able to write to and read from its controlling terminal...
py_compile
— Compile Python source filespy_compile — Compile Python source files Source code: Lib/py_compile.py The py_compile module provides a function to generate a byte-code file from a source file, and another function used when the module source file is in...
pyclbr
— Python module browser supportpyclbr — Python module browser support Source code: Lib/pyclbr.py The pyclbr module provides limited information about the functions, classes, and methods defined in a Python-coded module. The information is sufficient to...
pydoc
— Documentation generator and online help systempydoc — Documentation generator and online help system Source code: Lib/pydoc.py The pydoc module automatically generates documentation from Python modules. The documentation can be presented as pages of text on the conso...
queue
— A synchronized queue classqueue — A synchronized queue class Source code: Lib/queue.py The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely betw...
quopri
— Encode and decode MIME quoted-printable dataquopri — Encode and decode MIME quoted-printable data Source code: Lib/quopri.py This module performs quoted-printable transport encoding and decoding, as defined in RFC 1521: “MIME (Multipurpose Internet Mail Extensions)...
random
— Generate pseudo-random numbersrandom — Generate pseudo-random numbers Source code: Lib/random.py This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, the...
readline
— GNU readline interface...he readline module defines a number of functions to facilitate completion and reading/writing of history files from the Python interpreter. This module can be used directly, or via the rlcompleter module, which supports completion of Python...
reprlib
— Alternaterepr()
implementationreprlib — Alternate repr() implementation Source code: Lib/reprlib.py The reprlib module provides a means for producing object representations with limits on the size of the resulting strings. This is used in the Python de...
rlcompleter
— Completion function for GNU readlinerlcompleter — Completion function for GNU readline Source code: Lib/rlcompleter.py The rlcompleter module defines a completion function suitable to be passed to set_completer() in the readline module. When this module is i...
runpy
— Locating and executing Python modulesrunpy — Locating and executing Python modules Source code: Lib/runpy.py The runpy module is used to locate and run Python modules without importing them first. Its main use is to implement the -m command line switch that a...
sched
— Event schedulersched — Event scheduler Source code: Lib/sched.py The sched module defines a class which implements a general purpose event scheduler: class sched.scheduler(timefunc=time.monotonic, delayfunc=time.sleep) The scheduler cl...
secrets
— Generate secure random numbers for managing secrets...secrets — Generate secure random numbers for managing secrets Added in version 3.6. Source code: Lib/secrets.py The secrets module is used for generating cryptographically strong random numbers suitable for managing data such as...
selectors
— High-level I/O multiplexingselectors — High-level I/O multiplexing Added in version 3.4. Source code: Lib/selectors.py Introduction This module allows high-level and efficient I/O multiplexing, built upon the select module primitives. Users are e...
shelve
— Python object persistenceshelve — Python object persistence Source code: Lib/shelve.py A “shelf” is a persistent, dictionary-like object. The difference with “dbm” databases is that the values (not the keys!) in a shelf can be essentially arbitra...
shlex
— Simple lexical analysisshlex — Simple lexical analysis Source code: Lib/shlex.py The shlex class makes it easy to write lexical analyzers for simple syntaxes resembling that of the Unix shell. This will often be useful for writing minilanguages...
shutil
— High-level file operationsshutil — High-level file operations Source code: Lib/shutil.py The shutil module offers a number of high-level operations on files and collections of files. In particular, functions are provided which support file copyin...
signal
— Set handlers for asynchronous eventssignal — Set handlers for asynchronous events Source code: Lib/signal.py This module provides mechanisms to use signal handlers in Python. General rules The signal.signal() function allows defining custom handlers to be e...
site
— Site-specific configuration hooksite — Site-specific configuration hook Source code: Lib/site.py This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter’s -S option. Importing this module...
smtplib
— SMTP protocol clientsmtplib — SMTP protocol client Source code: Lib/smtplib.py The smtplib module defines an SMTP client session object that can be used to send mail to any internet machine with an SMTP or ESMTP listener daemon. For details...
socket
— Low-level networking interfacesocket — Low-level networking interface Source code: Lib/socket.py This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. No...
socketserver
— A framework for network serverssocketserver — A framework for network servers Source code: Lib/socketserver.py The socketserver module simplifies the task of writing network servers. Availability: not WASI. This module does not work or is not available...
sqlite3
— DB-API 2.0 interface for SQLite databases...Specification 2.0PEP written by Marc-André Lemburg. Tutorial In this tutorial, you will create a database of Monty Python movies using basic sqlite3 functionality. It assumes a fundamental understanding of database concepts, including...
ssl
— TLS/SSL wrapper for socket objectsssl — TLS/SSL wrapper for socket objects Source code: Lib/ssl.py This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network soc...
stat
— Interpretingstat()
resultsstat — Interpreting stat() results Source code: Lib/stat.py The stat module defines constants and functions for interpreting the results of os.stat(), os.fstat() and os.lstat() (if they exist). For complete details about...
statistics
— Mathematical statistics functionsstatistics — Mathematical statistics functions Added in version 3.4. Source code: Lib/statistics.py This module provides functions for calculating mathematical statistics of numeric (Real-valued) data. The module is not...
string
— Common string operationsstring — Common string operations Source code: Lib/string.py See also Text Sequence Type — str String Methods String constants The constants defined in this module are: string.ascii_letters The concatenation of the as...
stringprep
— Internet String Preparationstringprep — Internet String Preparation Source code: Lib/stringprep.py When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for “equality”. Exactly how this c...
struct
— Interpret bytes as packed binary datastruct — Interpret bytes as packed binary data Source code: Lib/struct.py This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversi...
subprocess
— Subprocess managementsubprocess — Subprocess management Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to r...
symtable
— Access to the compiler’s symbol tablessymtable — Access to the compiler’s symbol tables Source code: Lib/symtable.py Symbol tables are generated by the compiler from AST just before bytecode is generated. The symbol table is responsible for calculating the sc...
sys
— System-specific parameters and functions...always available. Unless explicitly noted otherwise, all variables are read-only. sys.abiflags On POSIX systems where Python was built with the standard configure script, this contains the ABI flags as specified by PEP 3149. Added in ver...
tabnanny
— Detection of ambiguous indentationtabnanny — Detection of ambiguous indentation Source code: Lib/tabnanny.py For the time being this module is intended to be called as a script. However it is possible to import it into an IDE and use the function check() d...
tarfile
— Read and write tar archive filestarfile — Read and write tar archive files Source code: Lib/tarfile.py The tarfile module makes it possible to read and write tar archives, including those using gzip, bz2 and lzma compression. Use the zipfile module to re...
tempfile
— Generate temporary files and directoriestempfile — Generate temporary files and directories Source code: Lib/tempfile.py This module creates temporary files and directories. It works on all supported platforms. TemporaryFile, NamedTemporaryFile, TemporaryDirect...
test
— Regression tests package for Pythontest — Regression tests package for Python Note The test package is meant for internal use by Python only. It is documented for the benefit of the core developers of Python. Any use of this package outside of Python’s stan...
textwrap
— Text wrapping and fillingtextwrap — Text wrapping and filling Source code: Lib/textwrap.py The textwrap module provides some convenience functions, as well as TextWrapper, the class that does all the work. If you’re just wrapping or filling one or...
threading
— Thread-based parallelismthreading — Thread-based parallelism Source code: Lib/threading.py This module constructs higher-level threading interfaces on top of the lower level _thread module. Changed in version 3.7: This module used to be optional...
timeit
— Measure execution time of small code snippetstimeit — Measure execution time of small code snippets Source code: Lib/timeit.py This module provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a callable one. It avo...
tkinter.colorchooser
— Color choosing dialogtkinter.colorchooser — Color choosing dialog Source code: Lib/tkinter/colorchooser.py The tkinter.colorchooser module provides the Chooser class as an interface to the native color picker dialog. Chooser implements a modal...
tkinter.dnd
— Drag and drop supporttkinter.dnd — Drag and drop support Source code: Lib/tkinter/dnd.py Note This is experimental and due to be deprecated when it is replaced with the Tk DND. The tkinter.dnd module provides drag-and-drop support for object...
tkinter.font
— Tkinter font wrappertkinter.font — Tkinter font wrapper Source code: Lib/tkinter/font.py The tkinter.font module provides the Font class for creating and using named fonts. The different font weights and slants are: tkinter.font.NORMAL tki...
tkinter.messagebox
— Tkinter message promptstkinter.messagebox — Tkinter message prompts Source code: Lib/tkinter/messagebox.py The tkinter.messagebox module provides a template base class as well as a variety of convenience methods for commonly used configurations....
tkinter.scrolledtext
— Scrolled Text Widgettkinter.scrolledtext — Scrolled Text Widget Source code: Lib/tkinter/scrolledtext.py The tkinter.scrolledtext module provides a class of the same name which implements a basic text widget which has a vertical scroll bar co...
tkinter.ttk
— Tk themed widgetstkinter.ttk — Tk themed widgets Source code: Lib/tkinter/ttk.py The tkinter.ttk module provides access to the Tk themed widget set, introduced in Tk 8.5. It provides additional benefits including anti-aliased font renderin...
tkinter
— Python interface to Tcl/Tktkinter — Python interface to Tcl/Tk Source code: Lib/tkinter/__init__.py The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit. Both Tk and tkinter are available on most Unix pla...
token
— Constants used with Python parse treestoken — Constants used with Python parse trees Source code: Lib/token.py This module provides constants which represent the numeric values of leaf nodes of the parse tree (terminal tokens). Refer to the file Grammar/Token...
tokenize
— Tokenizer for Python sourcetokenize — Tokenizer for Python source Source code: Lib/tokenize.py The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as we...
trace
— Trace or track Python statement executiontrace — Trace or track Python statement execution Source code: Lib/trace.py The trace module allows you to trace program execution, generate annotated statement coverage listings, print caller/callee relationships and list...
traceback
— Print or retrieve a stack tracebacktraceback — Print or retrieve a stack traceback Source code: Lib/traceback.py This module provides a standard interface to extract, format and print stack traces of Python programs. It is more flexible than the interpreter...
tracemalloc
— Trace memory allocationstracemalloc — Trace memory allocations Added in version 3.4. Source code: Lib/tracemalloc.py The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: Trac...
tty
— Terminal control functionstty — Terminal control functions Source code: Lib/tty.py The tty module defines functions for putting the tty into cbreak and raw modes. Availability: Unix. Because it requires the termios module, it will work only on Un...
turtle
— Turtle graphicsturtle — Turtle graphics Source code: Lib/turtle.py Introduction Turtle graphics is an implementation of the popular geometric drawing tools introduced in Logo, developed by Wally Feurzeig, Seymour Papert and Cynthia Solo...
types
— Dynamic type creation and names for built-in typestypes — Dynamic type creation and names for built-in types Source code: Lib/types.py This module defines utility functions to assist in dynamic creation of new types. It also defines names for some object types that are us...
typing
— Support for type hintstyping — Support for type hints Added in version 3.5. Source code: Lib/typing.py Note The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checker...
unittest.mock
— getting started...>> mock = MagicMock(side_effect=side_effect) >>> mock(1, 2) 1 >>> mock(2, 3) 2 Mocking asynchronous iterators Since Python 3.8, AsyncMock and MagicMock have support to mock Asynchronous Iterators through __aiter__. The return_value attr...
unittest.mock
— mock object libraryunittest.mock — mock object library Added in version 3.3. Source code: Lib/unittest/mock.py unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and...
unittest
— Unit testing frameworkunittest — Unit testing framework Source code: Lib/unittest/__init__.py (If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.) The unittest unit testing fram...
urllib.error
— Exception classes raised by urllib.requesturllib.error — Exception classes raised by urllib.request Source code: Lib/urllib/error.py The urllib.error module defines the exception classes for exceptions raised by urllib.request. The base exception class is URLErro...
urllib.parse
— Parse URLs into componentsurllib.parse — Parse URLs into components Source code: Lib/urllib/parse.py This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, pat...
urllib.request
— Extensible library for opening URLsurllib.request — Extensible library for opening URLs Source code: Lib/urllib/request.py The urllib.request module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world — basic and digest...
urllib.robotparser
— Parser for robots.txturllib.robotparser — Parser for robots.txt Source code: Lib/urllib/robotparser.py This module provides a single class, RobotFileParser, which answers questions about whether or not a particular user agent can fetch a URL...
uuid
— UUID objects according to RFC 4122uuid — UUID objects according to RFC 4122 Source code: Lib/uuid.py This module provides immutable UUID objects (the UUID class) and the functions uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5 UUI...
venv
— Creation of virtual environments...Lib/venv/ The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. A virtual environment is created on top of an existing Python insta...
warnings
— Warning controlwarnings — Warning control Source code: Lib/warnings.py Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warra...
wave
— Read and write WAV fileswave — Read and write WAV files Source code: Lib/wave.py The wave module provides a convenient interface to the Waveform Audio “WAVE” (or “WAV”) file format. Only uncompressed PCM encoded wave files are supported. Changed...
weakref
— Weak referencesweakref — Weak references Source code: Lib/weakref.py The weakref module allows the Python programmer to create weak references to objects. In the following, the term referent means the object which is referred to by a wea...
webbrowser
— Convenient web-browser controllerwebbrowser — Convenient web-browser controller Source code: Lib/webbrowser.py The webbrowser module provides a high-level interface to allow displaying web-based documents to users. Under most circumstances, simply calling...
wsgiref
— WSGI Utilities and Reference Implementation...Web Server Gateway Interface (WSGI) is a standard interface between web server software and web applications written in Python. Having a standard interface makes it easy to use an application that supports WSGI with a number of different we...
xml.dom.minidom
— Minimal DOM implementationxml.dom.minidom — Minimal DOM implementation Source code: Lib/xml/dom/minidom.py xml.dom.minidom is a minimal implementation of the Document Object Model interface, with an API similar to that in other languages. It is in...
xml.dom.pulldom
— Support for building partial DOM treesxml.dom.pulldom — Support for building partial DOM trees Source code: Lib/xml/dom/pulldom.py The xml.dom.pulldom module provides a “pull parser” which can also be asked to produce DOM-accessible fragments of the document w...
xml.dom
— The Document Object Model APIxml.dom — The Document Object Model API Source code: Lib/xml/dom/__init__.py The Document Object Model, or “DOM,” is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying XML documents....
xml.etree.ElementTree
— The ElementTree XML APIxml.etree.ElementTree — The ElementTree XML API Source code: Lib/xml/etree/ElementTree.py The xml.etree.ElementTree module implements a simple and efficient API for parsing and creating XML data. Changed in version 3.3: T...
xml.parsers.expat
— Fast XML parsing using Expatxml.parsers.expat — Fast XML parsing using Expat Warning The pyexpat module is not secure against maliciously constructed data. If you need to parse untrusted or unauthenticated data see XML vulnerabilities. The xml.par...
xml.sax.handler
— Base classes for SAX handlersxml.sax.handler — Base classes for SAX handlers Source code: Lib/xml/sax/handler.py The SAX API defines five kinds of handlers: content handlers, DTD handlers, error handlers, entity resolvers and lexical handlers. Applica...
xml.sax.saxutils
— SAX Utilitiesxml.sax.saxutils — SAX Utilities Source code: Lib/xml/sax/saxutils.py The module xml.sax.saxutils contains a number of classes and functions that are commonly useful when creating SAX applications, either in direct use, or...
xml.sax.xmlreader
— Interface for XML parsersxml.sax.xmlreader — Interface for XML parsers Source code: Lib/xml/sax/xmlreader.py SAX parsers implement the XMLReader interface. They are implemented in a Python module, which must provide a function create_parser(). Thi...
xml.sax
— Support for SAX2 parsersxml.sax — Support for SAX2 parsers Source code: Lib/xml/sax/__init__.py The xml.sax package provides a number of modules which implement the Simple API for XML (SAX) interface for Python. The package itself provides the S...
xmlrpc.client
— XML-RPC client accessxmlrpc.client — XML-RPC client access Source code: Lib/xmlrpc/client.py XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a transport. With it, a client can call methods with parameters on a re...
xmlrpc.server
— Basic XML-RPC serversxmlrpc.server — Basic XML-RPC servers Source code: Lib/xmlrpc/server.py The xmlrpc.server module provides a basic server framework for XML-RPC servers written in Python. Servers can either be free standing, using SimpleXM...
zipapp
— Manage executable Python zip archiveszipapp — Manage executable Python zip archives Added in version 3.5. Source code: Lib/zipapp.py This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by th...
zipfile
— Work with ZIP archives...rchives, but it currently cannot create an encrypted file. Decryption is extremely slow as it is implemented in native Python rather than C. The module defines the following items: exception zipfile.BadZipFile The error raised for bad ZI...
zipimport
— Import modules from Zip archiveszipimport — Import modules from Zip archives Source code: Lib/zipimport.py This module adds the ability to import Python modules (*.py, *.pyc) and packages from ZIP-format archives. It is usually not needed to use the zipi...
- 1. Command line and environment
1. Command line and environment The CPython interpreter scans the command line and the environment for various settings. CPython implementation detail: Other implementations’ command line schemes may differ. See Alternate...
- 1. Extending Python with C or C++
1. Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can’t be done directly in Python: they can implement...
- 10. Brief Tour of the Standard Library
...r interacting with the operating system: >>> import os >>> os.getcwd() # Return the current working directory 'C:\\Python313' >>> os.chdir('/server/accesslogs') # Change current working directory >>> os.system('mkdir today') # Run...
- 11. Brief Tour of the Standard Library — Part II
...ze their applications without having to alter the application. The format uses placeholder names formed by $ with valid Python identifiers (alphanumeric characters and underscores). Surrounding the placeholder with braces allows it to be f...
- 12. Virtual Environments and Packages
12. Virtual Environments and Packages 12.1. Introduction Python applications will often use packages and modules that don’t come as part of the standard library. Applications will sometimes need a specific version of a li...
- 16. Appendix
...rolling color for details. Function keys provide some additional functionality. F1 enters the interactive help browser pydoc. F2 allows for browsing command-line history with neither output nor the >>> and … prompts. F3 enters “paste mode”...
- 2. Defining Extension Types: Tutorial
2. Defining Extension Types: Tutorial Python allows the writer of a C extension module to define new types that can be manipulated from Python code, much like the built-in str and list types. The code for all extension typ...
- 2. Using the Python Interpreter
2. Using the Python Interpreter 2.1. Invoking the Interpreter The Python interpreter is usually installed as /usr/local/bin/python3.13 on those machines where it is available; putting /usr/local/bin in your Unix shell’s se...
- 3. An Informal Introduction to Python
3. An Informal Introduction to Python In the following examples, input and output are distinguished by the presence or absence of prompts (>>> and …): to repeat the example, you must type everything after the prompt, when t...
- 3. Configure Python
3. Configure Python 3.1. Build Requirements Features and minimum versions required to build CPython: A C11 compiler. Optional C11 features are not required. On Windows, Microsoft Visual Studio 2017 or later is required. S...
- 3. Data model
3. Data model 3.1. Objects, values and types Objects are Python’s abstraction for data. All data in a Python program is represented by objects or by relations between objects. (In a sense, and in conformance to Von Neuman...
- 4. More Control Flow Tools
4. More Control Flow Tools As well as the while statement just introduced, Python uses a few more that we will encounter in this chapter. 4.1. if Statements Perhaps the most well-known statement type is the if statement....
- 4. Using Python on Windows
4. Using Python on Windows This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix systems and services, Windows does not include a...
- 5. The import system
5. The import system Python code in one module gains access to the code in another module by the process of importing it. The import statement is the most common way of invoking the import machinery, but it is not the only...
- 5. Using Python on macOS
5. Using Python on macOS This document aims to give an overview of macOS-specific behavior you should know about to get started with Python on Mac computers. Python on a Mac running macOS is very similar to Python on other...
- 6. Expressions
6. Expressions This chapter explains the meaning of the elements of expressions in Python. Syntax Notes: In this and the following chapters, extended BNF notation will be used to describe syntax, not lexical analysis. When...
- 6. Modules
6. Modules If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a...
- 9. Classes
...tances can also have methods (defined by its class) for modifying its state. Compared with other programming languages, Python’s class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanis...
- Argparse Tutorial
...This tutorial is intended to be a gentle introduction to argparse, the recommended command-line parsing module in the Python standard library. Note The standard library includes two other libraries directly related to command-line parame...
- Built-in Exceptions
Built-in Exceptions In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that clause also handles any exception...
- Built-in Functions
Built-in Functions The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order. Built-in Functions A abs() aiter() all() anext() any(...
- Built-in Types
...interpreted as not (a == b), and a == not b is a syntax error. Comparisons There are eight comparison operations in Python. They all have the same priority (which is higher than that of the Boolean operations). Comparisons can be chai...
- Changelog
Changelog Python next Release date: XXXX-XX-XX Library gh-129583: Update bundled pip to 25.0.1 gh-97850: Update the deprecation warning of importlib.abc.Loader.load_module(). gh-129646: Update the locale alias mapping in...
- Coroutines and Tasks
...ng in Threads Scheduling From Other Threads Introspection Task Object Coroutines Source code: Lib/asyncio/coroutines.py Coroutines declared with the async/await syntax is the preferred way of writing asyncio applications. For example,...
- Descriptor Guide
Descriptor Guide Author: Raymond Hettinger Contact: <python at rcn dot com> Contents Descriptor Guide Primer Simple example: A descriptor that returns a constant Dynamic lookups Managed attributes Customized names C...
- Design and History FAQ
Design and History FAQ Contents 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 s...
- Developing with asyncio
...der to ease the development asyncio has a debug mode. There are several ways to enable asyncio debug mode: Setting the PYTHONASYNCIODEBUG environment variable to 1. Using the Python Development Mode. Passing debug=True to asyncio.run(). Ca...
- Event Loop
Event Loop Source code: Lib/asyncio/events.py, Lib/asyncio/base_events.py Preface The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO operations, an...
- Exceptions
Exceptions Source code: Lib/asyncio/exceptions.py exception asyncio.TimeoutError A deprecated alias of TimeoutError, raised when the operation has exceeded the given deadline. Changed in version 3.11: This class was mad...
- Extending
...rs that could be used to simplify this task. Note Third-parties should reuse existing asyncio code with caution, a new Python version is free to break backward compatibility in internal part of API. Writing a Custom Event Loop asyncio.Ab...
- Extending/Embedding FAQ
...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 Pyt...
- Functional Programming HOWTO
...Functional Programming HOWTO Author: A. M. Kuchling Release: 0.32 In this document, we’ll take a tour of Python’s features suitable for implementing programs in a functional style. After an introduction to the concepts of fu...
- Futures
Futures Source code: Lib/asyncio/futures.py, Lib/asyncio/base_futures.py Future objects are used to bridge low-level callback-based code with high-level async/await code. Future Functions asyncio.isfuture(obj) Return Tr...
- General Python FAQ
General Python FAQ Contents General Python FAQ General Information What is Python? What is the Python Software Foundation? Are there copyright restrictions on the use of Python? Why was Python created in the first place...
- Glossary
Glossary >>>The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter. ...Can refer to: The default Python prompt of the interactive shell wh...
- IDLE — Python editor and shell
IDLE — Python editor and shell Source code: Lib/idlelib/ IDLE is Python’s Integrated Development and Learning Environment. IDLE has the following features: cross-platform: works mostly the same on Windows, Unix, and macOS...
- Installing Python Modules
Installing Python Modules Email: distutils-sig@python.org As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for othe...
- Instrumenting CPython with DTrace and SystemTap
Instrumenting CPython with DTrace and SystemTap author: David Malcolm author: Łukasz Langa DTrace and SystemTap are monitoring tools, each providing a way to inspect what the processes on a computer system are doing. T...
- Introduction
Introduction The Application Programmer’s Interface to Python gives C and C++ programmers access to the Python interpreter at a variety of levels. The API is equally usable from C++, but for brevity it is generally referre...
- Logging Cookbook
...same logger object. This is true not only within the same module, but also across modules as long as it is in the same Python interpreter process. It is true for references to the same object; additionally, application code can define and...
- Logging HOWTO
...that of recording logging events in a file, so let’s look at that next. Be sure to try the following in a newly started Python interpreter, and don’t just continue from the session described above: import logging logger = logging.getLogger(...
- Module Objects
Module Objects PyTypeObject PyModule_Type Part of the Stable ABI.This instance of PyTypeObject represents the Python module type. This is exposed to Python programs as types.ModuleType. int PyModule_Check(PyObject *...
- Platform Support
..._reader() and loop.add_writer() cannot be used to monitor file I/O. Windows Source code: Lib/asyncio/proactor_events.py, Lib/asyncio/windows_events.py, Lib/asyncio/windows_utils.py Changed in version 3.8: On Windows, ProactorEventLoop...
- Programming FAQ
...pping, etc.? Are there tools to help find bugs or perform static analysis? How can I create a stand-alone binary from a Python script? Are there coding standards or a style guide for Python programs? Core Language Why am I getting an Unb...
- Python Development Mode
Python Development Mode Added in version 3.7. The Python Development Mode introduces additional runtime checks that are too expensive to be enabled by default. It should not be more verbose than the default if the code is...
- Python Documentation contents
Python Documentation contents What’s New in Python What’s New In Python 3.13 Summary – Release Highlights New Features A better interactive interpreter Improved error messages Free-threaded CPython An experimental just-in...
- Python experimental support for free threading
Python experimental support for free threading Starting with the 3.13 release, CPython has experimental support for a build of Python called free threading where the global interpreter lock (GIL) is disabled. Free-threaded...
- Python Initialization Configuration
Python Initialization Configuration Added in version 3.8. Python can be initialized with Py_InitializeFromConfig() and the PyConfig structure. It can be preinitialized with Py_PreInitialize() and the PyPreConfig structure...
- Python on Windows FAQ
Python on Windows FAQ Contents 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...
- Python Runtime Services
Python Runtime Services The modules described in this chapter provide a wide range of services related to the Python interpreter and its interaction with its environment. Here’s an overview: sys — System-specific paramet...
- Python support for the Linux
perf
profilerPython support for the Linux perf profiler author: Pablo Galindo The Linux perf profiler is a very powerful tool that allows you to profile and obtain information about the performance of your application. perf also has...
- Queues
Queues Source code: Lib/asyncio/queues.py asyncio queues are designed to be similar to classes of the queue module. Although asyncio queues are not thread-safe, they are designed to be used specifically in async/await cod...
- Runners
Runners Source code: Lib/asyncio/runners.py This section outlines high-level asyncio primitives to run asyncio code. They are built on top of an event loop with the aim to simplify async code usage for common wide-spread sc...
- Socket Programming HOWTO
...t(socket.AF_INET, socket.SOCK_STREAM) # now connect to the web server on port 80 - the normal http port s.connect(("www.python.org", 80)) When the connect completes, the socket s can be used to send in a request for the text of the page....
- Sorting Techniques
Sorting Techniques Author: Andrew Dalke and Raymond Hettinger Python lists have a built-in list.sort() method that modifies the list in-place. There is also a sorted() built-in function that builds a new sorted list fro...
- Streams
Streams Source code: Lib/asyncio/streams.py Streams are high-level async/await-ready primitives to work with network connections. Streams allow sending and receiving data without using callbacks or low-level protocols and...
- Subprocesses
Subprocesses Source code: Lib/asyncio/subprocess.py, Lib/asyncio/base_subprocess.py This section describes high-level async/await asyncio APIs to create and manage subprocesses. Here’s an example of how asyncio can run a s...
- Support for Perf Maps
...Maps On supported platforms (as of this writing, only Linux), the runtime can take advantage of perf map files to make Python functions visible to an external profiling tool (such as perf). A running process may create a file in the /tmp d...
- Synchronization Primitives
Synchronization Primitives Source code: Lib/asyncio/locks.py asyncio synchronization primitives are designed to be similar to those of the threading module with two important caveats: asyncio primitives are not thread-saf...
- The initialization of the
sys.path
module search pathThe initialization of the sys.path module search path A module search path is initialized when Python starts. This module search path may be accessed at sys.path. The first entry in the module search path is the directory t...
- The Python 2.3 Method Resolution Order
The Python 2.3 Method Resolution Order Note This is a historical document, provided as an appendix to the official documentation. The Method Resolution Order discussed here was introduced in Python 2.3, but it is still use...
- The Python Profilers
The Python Profilers Source code: Lib/profile.py and Lib/pstats.py Introduction to the profilers cProfile and profile provide deterministic profiling of Python programs. A profile is a set of statistics that describes how...
- Tkinter Dialogs
...Tkinter Dialogs tkinter.simpledialog — Standard Tkinter input dialogs Source code: Lib/tkinter/simpledialog.py The tkinter.simpledialog module contains convenience classes and functions for creating simple modal dialogs to get...
- Transports and Protocols
...how to work with transports, protocols, and low-level event loop APIs. Transports Source code: Lib/asyncio/transports.py Transports are classes provided by asyncio in order to abstract various kinds of communication channels. Transport o...
- Type Objects
Type Objects Perhaps one of the most important structures of the Python object system is the structure that defines a new type: the PyTypeObject structure. Type objects can be handled using any of the PyObject_* or PyType_...
- Type Objects
Type Objects type PyTypeObject Part of the Limited API (as an opaque struct).The C structure of the objects used to describe built-in types. PyTypeObject PyType_Type Part of the Stable ABI.This is the type object fo...
- Unicode HOWTO
Unicode HOWTO Release: 1.12 This HOWTO discusses Python’s support for the Unicode specification for representing textual data, and explains various problems that people commonly encounter when trying to work with Unicode...
- What’s New in Python 2.0
What’s New in Python 2.0 Author: A.M. Kuchling and Moshe Zadka Introduction A new release of Python, version 2.0, was released on October 16, 2000. This article covers the exciting new features in 2.0, highlights some o...
- What’s New in Python 2.1
What’s New in Python 2.1 Author: A.M. Kuchling Introduction This article explains the new features in Python 2.1. While there aren’t as many changes in 2.1 as there were in Python 2.0, there are still some pleasant sur...
- What’s New in Python 2.2
What’s New in Python 2.2 Author: A.M. Kuchling Introduction This article explains the new features in Python 2.2.2, released on October 14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, originally released on D...
- What’s New in Python 2.3
What’s New in Python 2.3 Author: A.M. Kuchling This article explains the new features in Python 2.3. Python 2.3 was released on July 29, 2003. The main themes for Python 2.3 are polishing some of the features added in 2...
- What’s New in Python 2.4
What’s New in Python 2.4 Author: A.M. Kuchling This article explains the new features in Python 2.4.1, released on March 30, 2005. Python 2.4 is a medium-sized release. It doesn’t introduce as many changes as the radica...
- What’s New in Python 2.5
What’s New in Python 2.5 Author: A.M. Kuchling This article explains the new features in Python 2.5. The final release of Python 2.5 is scheduled for August 2006; PEP 356 describes the planned release schedule. Python...
- What’s New in Python 2.6
What’s New in Python 2.6 Author: A.M. Kuchling (amk at amk.ca) This article explains the new features in Python 2.6, released on October 1, 2008. The release schedule is described in PEP 361. The major theme of Python 2...
- What’s New in Python 2.7
What’s New in Python 2.7 Author: A.M. Kuchling (amk at amk.ca) This article explains the new features in Python 2.7. Python 2.7 was released on July 3, 2010. Numeric handling has been improved in many ways, for both flo...
- What’s New In Python 3.1
What’s New In Python 3.1 Author: Raymond Hettinger This article explains the new features in Python 3.1, compared to 3.0. Python 3.1 was released on June 27, 2009. PEP 372: Ordered Dictionaries Regular Python dictionari...
- What’s New In Python 3.10
What’s New In Python 3.10 Editor: Pablo Galindo Salgado This article explains the new features in Python 3.10, compared to 3.9. Python 3.10 was released on October 4, 2021. For full details, see the changelog. Summary –...
- What’s New In Python 3.12
What’s New In Python 3.12 Editor: Adam Turner This article explains the new features in Python 3.12, compared to 3.11. Python 3.12 was released on October 2, 2023. For full details, see the changelog. See also PEP 693 –...
- What’s New In Python 3.13
What’s New In Python 3.13 Editors: Adam Turner and Thomas Wouters This article explains the new features in Python 3.13, compared to 3.12. Python 3.13 was released on October 7, 2024. For full details, see the changelog....
- What’s New In Python 3.2
What’s New In Python 3.2 Author: Raymond Hettinger This article explains the new features in Python 3.2 as compared to 3.1. Python 3.2 was released on February 20, 2011. It focuses on a few highlights and gives a few exa...
- What’s New In Python 3.3
What’s New In Python 3.3 This article explains the new features in Python 3.3, compared to 3.2. Python 3.3 was released on September 29, 2012. For full details, see the changelog. See also PEP 398 - Python 3.3 Release Sch...
- What’s New In Python 3.4
What’s New In Python 3.4 Author: R. David Murray <rdmurray@bitdance.com> (Editor) This article explains the new features in Python 3.4, compared to 3.3. Python 3.4 was released on March 16, 2014. For full details, see t...
- What’s New In Python 3.5
What’s New In Python 3.5 Editors: Elvis Pranskevichus <elvis@magic.io>, Yury Selivanov <yury@magic.io> This article explains the new features in Python 3.5, compared to 3.4. Python 3.5 was released on September 13, 2015....
- What’s New In Python 3.6
What’s New In Python 3.6 Editors: Elvis Pranskevichus <elvis@magic.io>, Yury Selivanov <yury@magic.io> This article explains the new features in Python 3.6, compared to 3.5. Python 3.6 was released on December 23, 2016....
- What’s New In Python 3.7
What’s New In Python 3.7 Editor: Elvis Pranskevichus <elvis@magic.io> This article explains the new features in Python 3.7, compared to 3.6. Python 3.7 was released on June 27, 2018. For full details, see the changelog....
- What’s New In Python 3.8
What’s New In Python 3.8 Editor: Raymond Hettinger This article explains the new features in Python 3.8, compared to 3.7. Python 3.8 was released on October 14, 2019. For full details, see the changelog. Summary – Relea...
- What’s New In Python 3.9
What’s New In Python 3.9 Editor: Łukasz Langa This article explains the new features in Python 3.9, compared to 3.8. Python 3.9 was released on October 5, 2020. For full details, see the changelog. See also PEP 596 - Py...