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 implementati...| Python documentation
Source code: Lib/string/templatelib.py Template strings: Template strings are a mechanism for custom string processing. They have the full flexibility of Python’s f-strings, but return a Template i...| Python documentation
By Michele Simionato. Abstract, This document is intended for Python programmers who want to understand the C3 Method Resolution Order used in Python 2.3. Although it is not intended for newbies, i...| Python documentation
A C extension for CPython is a shared library (for example, a.so file on Linux,.pyd DLL on Windows), which is loadable into the Python process (for example, it is compiled with compatible compiler ...| Python documentation
The atexit module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. atexit runs these functio...| Python documentation
This section aims to give a quick fly-by on the various type methods you can implement and what they do. Here is the definition of PyTypeObject, with some fields only used in debug builds omitted: ...| Python documentation
For applications that require data compression, the functions in this module allow compression and decompression, using the zlib library. The zlib library has its own home page at https://www.zlib....| Python documentation
Source code: Lib/lzma.py This module provides classes and convenience functions for compressing and decompressing data using the LZMA compression algorithm. Also included is a file interface suppor...| Python documentation
Source code: Lib/compression/zstd/__init__.py This module provides classes and functions for compressing and decompressing data using the Zstandard (or zstd) compression algorithm. The zstd manual ...| Python documentation
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() function and...| Python documentation
Python 2.7.18 documentation| docs.python.org
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 issues in an ap...| Python documentation
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...| Python documentation
Source code: Lib/email/contentmanager.py Content Manager Instances: Currently the email package provides only one concrete content manager, raw_data_manager, although more may be added in the futur...| Python documentation
Source code: Lib/platform.py Cross platform: Java platform: Windows platform: macOS platform: iOS platform: Unix platforms: Linux platforms: Android platform: Command-line usage: platform can also ...| Python documentation
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_...| Python documentation
Initializing C modules: Modules objects are usually created from extension modules (shared libraries which export an initialization function), or compiled-in modules (where the initialization funct...| Python documentation
CPython supports two different calling protocols: tp_call and vectorcall. The tp_call Protocol: Instances of classes that set tp_call are callable. The signature of the slot is: A call is made usin...| Python documentation
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 two text st...| Python documentation
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 to read or write one file see open...| Python documentation
28.2. sysconfig — Provide access to Python’s configuration information¶| docs.python.org
17.2. socket — Low-level networking interface¶| docs.python.org
Interactive Mode: There are two variants of the interactive REPL. The classic basic interpreter is supported on all platforms with minimal line control capabilities. On Windows, or Unix-like system...| Python documentation
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 allows scripts to be lo...| Python documentation
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, (for e...| Python documentation
5. Creating Built Distributions¶| docs.python.org
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 excep...| Python documentation
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 weak...| Python documentation
Source code: Lib/zipfile/ The ZIP file format is a common archive and compression standard. This module provides tools to create, read, write, append, and list a ZIP file. Any advanced use of this ...| Python documentation
Unicode Objects: Since the implementation of PEP 393 in Python 3.3, Unicode objects internally use a variety of representations, in order to allow handling the complete range of Unicode characters ...| Python documentation
The Formatter class has the following public methods:| docs.python.org
The Python Standard Library¶| docs.python.org
Source code: Lib/email/mime/ This module is part of the legacy ( Compat32) email API. Its functionality is partially replaced by the contentmanager in the new API, but in certain applications these...| Python documentation
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 2821), NNTP, or othe...| Python documentation
Editors, Adam Turner and Hugo van Kemenade,. This article explains the new features in Python 3.14, compared to 3.13. Python 3.14 will be released on 7 October 2025. For full details, see the chang...| Python documentation
Creating Heap-Allocated Types: The following functions and structs are used to create heap types.| Python documentation
The functions and macros in this section are used for managing reference counts of Python objects.| Python documentation
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 equivalent to the expres...| Python documentation
15.1.1. Process Parameters¶| docs.python.org
15.16. errno — Standard errno system symbols¶| docs.python.org
This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides acc...| Python documentation
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 execution allows for f...| Python documentation
Overview: Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the Python memory manag...| Python documentation
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 arbitrary Python o...| Python documentation
The “Python library” contains several different kinds of components. It contains data types that would normally be considered part of the “core” of a language, such as numbers and lists. For these ...| Python documentation
Source code: Lib/email/utils.py There are a couple of useful utilities provided in the email.utils module: The remaining functions are part of the legacy ( Compat32) email API. There is no need to ...| Python documentation
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 using the dicti...| Python documentation
Source code: Lib/email/message.py The central class in the email package is the EmailMessage class, imported from the email.message module. It is the base class for the email object model. EmailMes...| Python documentation
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 dictionary-like API of ...| Python documentation
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 will need to do thi...| Python documentation
Source code: Lib/email/errors.py The following exception classes are defined in the email.errors module: Here is the list of the defects that the FeedParser can find while parsing messages. Note th...| Python documentation
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 original document...| Python documentation
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 module make it straigh...| Python documentation
There are several ways to present the output of a program; data can be printed in a human-readable form, or written to a file for future use. This chapter will discuss some of the possibilities. Fa...| Python documentation
7. Compound statements¶| docs.python.org
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’s default traceback di...| Python documentation
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 correct; new warnings...| Python documentation
Source code: Lib/getopt.py This module helps scripts to parse the command line arguments in sys.argv. It supports the same conventions as the Unix getopt() function (including the special meanings ...| Python documentation
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.,...| Python documentation
5.2. Atoms¶| docs.python.org
The first version requires that numerator and denominator are instances| docs.python.org
9.4.1. Quick-start Tutorial¶| docs.python.org
>>>The default Python prompt of the interactive shell. Often seen for code| docs.python.org
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 gener...| Python documentation
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 in this module ...| Python documentation
Source code: Lib/logging/handlers.py Important: This page contains only reference information. For tutorials, please see Basic Tutorial, Advanced Tutorial, Logging Cookbook. The following useful ha...| Python documentation
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 sockets, both clien...| Python documentation
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 format of email messages (a ...| Python documentation
The Message class is very similar to the EmailMessage class, without the methods added by that class, and with the default behavior of certain other methods being slightly different. We also docume...| Python documentation
2. Built-in Functions¶| docs.python.org
4. Built-in Constants¶| docs.python.org
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__' expression; and,...| Python documentation
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 Microsoft Windows ...| Python documentation
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 fault handlers for the SIGSEGV, SIGFPE, ...| Python documentation
Source code: Lib/threading.py This module constructs higher-level threading interfaces on top of the lower level_thread module. CPython implementation detail: In CPython, due to the Global Interpre...| Python documentation
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 of SMTP...| Python documentation
This section outlines high-level asyncio APIs to work with coroutines and Tasks. Coroutines, Awaitables, Creating Tasks, Task Cancellation, Task Groups, Sleeping, Running Tasks Concurrently, Eager ...| Python documentation
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 read or write.zip fi...| Python documentation
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 statement (and thus, by extension, the__i...| Python documentation
Source code: Lib/xml/etree/ElementTree.py The xml.etree.ElementTree module implements a simple and efficient API for parsing and creating XML data. Tutorial: This is a short tutorial for using xml....| Python documentation
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. ...| Python documentation
Execute a child program in a new process. On Unix, the class uses| docs.python.org
15.3. time — Time access and conversions¶| docs.python.org
7.1. Fancier Output Formatting¶| docs.python.org
28.1. sys — System-specific parameters and functions¶| docs.python.org
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. Availability: not ...| Python documentation
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 arbitrary order. No til...| Python documentation
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, these calendars have...| Python documentation
Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have ...| Python documentation
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 the Python interpreter. The module provides both ...| Python documentation
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 ...| Python documentation
Asynchronous programming is different from classic “sequential” programming. This page lists common mistakes and traps and explains how to avoid them. Debug Mode: By default asyncio runs in product...| Python documentation
Preface Transports and Protocols are used by the low-level event loop APIs such as loop.create_connection(). They use callback-based programming style and enable high-performance implementations of...| Python documentation
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 applications...| Python documentation
There are a large number of structures which are used in the definition of object types for Python. This section describes these structures and how they are used. Base object types and macros: All ...| Python documentation
These functions are useful when creating your own extension functions and methods. Additional information and examples are available in Extending and Embedding the Python Interpreter. The first thr...| Python documentation
Source code: Lib/tracemalloc.py The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: Traceback where an object was allocated, St...| Python documentation
Author, Guido van Rossum,. This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever intentionally backwards incomp...| Python documentation