22/06/2026, 13:05 The Python Standard Library — Python 3.14.
6 documentation
The Python Standard Library
While The Python Language Reference describes the exact syntax and semantics of the Python language,
this library reference manual describes the standard library that is distributed with Python. It also de‐
scribes some of the optional components that are commonly included in Python distributions.
Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table
of contents listed below. The library contains built-in modules (written in C) that provide access to system
functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as mod‐
ules written in Python that provide standardized solutions for many problems that occur in everyday pro‐
gramming. Some of these modules are explicitly designed to encourage and enhance the portability of
Python programs by abstracting away platform-specifics into platform-neutral APIs.
The Python installers for the Windows platform usually include the entire standard library and often also
include many additional components. For Unix-like operating systems Python is normally provided as a
collection of packages, so it may be necessary to use the packaging tools provided with the operating
system to obtain some or all of the optional components.
In addition to the standard library, there is an active collection of hundreds of thousands of components
(from individual programs and modules to packages and entire application development frameworks),
available from the Python Package Index.
Introduction
Notes on availability
Built-in Functions
Built-in Constants
Constants added by the site module
Built-in Types
Truth Value Testing
Boolean Operations — and , or , not
Comparisons
Numeric Types — int , float , complex
Boolean Type - bool
Iterator Types
Sequence Types — list , tuple , range
Text and Binary Sequence Type Methods Summary
Text Sequence Type — str
Binary Sequence Types — bytes , bytearray , memoryview
Set Types — set , frozenset
Mapping Types — dict
Context Manager Types
Type Annotation Types — Generic Alias, Union
Other Built-in Types
Special Attributes
Integer string conversion length limitation
[Link] 1/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
Built-in Exceptions
Exception context
Inheriting from built-in exceptions
Base classes
Concrete exceptions
Warnings
Exception groups
Exception hierarchy
Thread Safety Guarantees
Thread safety levels
Thread safety for list objects
Thread safety for dict objects
Thread safety for set objects
Thread safety for bytearray objects
Thread safety for memoryview objects
Text Processing Services
string — Common string operations
[Link] — Support for template string literals
re — Regular expression operations
difflib — Helpers for computing deltas
textwrap — Text wrapping and filling
unicodedata — Unicode Database
stringprep — Internet String Preparation
readline — GNU readline interface
rlcompleter — Completion function for GNU readline
Binary Data Services
struct — Interpret bytes as packed binary data
codecs — Codec registry and base classes
Data Types
datetime — Basic date and time types
zoneinfo — IANA time zone support
calendar — General calendar-related functions
collections — Container datatypes
[Link] — Abstract Base Classes for Containers
heapq — Heap queue algorithm
bisect — Array bisection algorithm
array — Efficient arrays of numeric values
weakref — Weak references
types — Dynamic type creation and names for built-in types
copy — Shallow and deep copy operations
pprint — Data pretty printer
reprlib — Alternate repr() implementation
enum — Support for enumerations
graphlib — Functionality to operate with graph-like structures
Numeric and Mathematical Modules
numbers — Numeric abstract base classes
[Link] 2/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
math — Mathematical functions
cmath — Mathematical functions for complex numbers
decimal — Decimal fixed-point and floating-point arithmetic
fractions — Rational numbers
random — Generate pseudo-random numbers
statistics — Mathematical statistics functions
Functional Programming Modules
itertools — Functions creating iterators for efficient looping
functools — Higher-order functions and operations on callable objects
operator — Standard operators as functions
File and Directory Access
pathlib — Object-oriented filesystem paths
[Link] — Common pathname manipulations
stat — Interpreting stat() results
filecmp — File and Directory Comparisons
tempfile — Generate temporary files and directories
glob — Unix style pathname pattern expansion
fnmatch — Unix filename pattern matching
linecache — Random access to text lines
shutil — High-level file operations
Data Persistence
pickle — Python object serialization
copyreg — Register pickle support functions
shelve — Python object persistence
marshal — Internal Python object serialization
dbm — Interfaces to Unix “databases”
sqlite3 — DB-API 2.0 interface for SQLite databases
Data Compression and Archiving
The compression package
[Link] — Compression compatible with the Zstandard format
zlib — Compression compatible with gzip
gzip — Support for gzip files
bz2 — Support for bzip2 compression
lzma — Compression using the LZMA algorithm
zipfile — Work with ZIP archives
tarfile — Read and write tar archive files
File Formats
csv — CSV File Reading and Writing
configparser — Configuration file parser
tomllib — Parse TOML files
netrc — netrc file processing
plistlib — Generate and parse Apple .plist files
Cryptographic Services
hashlib — Secure hashes and message digests
hmac — Keyed-Hashing for Message Authentication
secrets — Generate secure random numbers for managing secrets
[Link] 3/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
Generic Operating System Services
os — Miscellaneous operating system interfaces
io — Core tools for working with streams
time — Time access and conversions
logging — Logging facility for Python
[Link] — Logging configuration
[Link] — Logging handlers
platform — Access to underlying platform’s identifying data
errno — Standard errno system symbols
ctypes — A foreign function library for Python
Command-line interface libraries
argparse — Parser for command-line options, arguments and subcommands
optparse — Parser for command line options
getpass — Portable password input
fileinput — Iterate over lines from multiple input streams
curses — Terminal handling for character-cell displays
[Link] — Text input widget for curses programs
[Link] — Utilities for ASCII characters
[Link] — A panel stack extension for curses
cmd — Support for line-oriented command interpreters
Concurrent Execution
threading — Thread-based parallelism
multiprocessing — Process-based parallelism
multiprocessing.shared_memory — Shared memory for direct access across processes
The concurrent package
[Link] — Launching parallel tasks
[Link] — Multiple interpreters in the same process
subprocess — Subprocess management
sched — Event scheduler
queue — A synchronized queue class
contextvars — Context Variables
_thread — Low-level threading API
Networking and Interprocess Communication
asyncio — Asynchronous I/O
socket — Low-level networking interface
ssl — TLS/SSL wrapper for socket objects
select — Waiting for I/O completion
selectors — High-level I/O multiplexing
signal — Set handlers for asynchronous events
mmap — Memory-mapped file support
Internet Data Handling
email — An email and MIME handling package
json — JSON encoder and decoder
mailbox — Manipulate mailboxes in various formats
mimetypes — Map filenames to MIME types
base64 — Base16, Base32, Base64, Base85 Data Encodings
[Link] 4/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
binascii — Convert between binary and ASCII
quopri — Encode and decode MIME quoted-printable data
Structured Markup Processing Tools
html — HyperText Markup Language support
[Link] — Simple HTML and XHTML parser
[Link] — Definitions of HTML general entities
XML Processing Modules
[Link] — The ElementTree XML API
[Link] — The Document Object Model API
[Link] — Minimal DOM implementation
[Link] — Support for building partial DOM trees
[Link] — Support for SAX2 parsers
[Link] — Base classes for SAX handlers
[Link] — SAX Utilities
[Link] — Interface for XML parsers
[Link] — Fast XML parsing using Expat
Internet Protocols and Support
webbrowser — Convenient web-browser controller
wsgiref — WSGI Utilities and Reference Implementation
urllib — URL handling modules
[Link] — Extensible library for opening URLs
[Link] — Response classes used by urllib
[Link] — Parse URLs into components
[Link] — Exception classes raised by [Link]
[Link] — Parser for [Link]
http — HTTP modules
[Link] — HTTP protocol client
ftplib — FTP protocol client
poplib — POP3 protocol client
imaplib — IMAP4 protocol client
smtplib — SMTP protocol client
uuid — UUID objects according to RFC 9562
socketserver — A framework for network servers
[Link] — HTTP servers
[Link] — HTTP state management
[Link] — Cookie handling for HTTP clients
xmlrpc — XMLRPC server and client modules
[Link] — XML-RPC client access
[Link] — Basic XML-RPC servers
ipaddress — IPv4/IPv6 manipulation library
Multimedia Services
wave — Read and write WAV files
colorsys — Conversions between color systems
Internationalization
gettext — Multilingual internationalization services
locale — Internationalization services
[Link] 5/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
Graphical user interfaces with Tk
tkinter — Python interface to Tcl/Tk
[Link] — Color choosing dialog
[Link] — Tkinter font wrapper
Tkinter dialogs
[Link] — Tkinter message prompts
[Link] — Scrolled text widget
[Link] — Drag and drop support
[Link] — Tk themed widgets
IDLE — Python editor and shell
turtle — Turtle graphics
Development Tools
typing — Support for type hints
pydoc — Documentation generator and online help system
Python Development Mode
doctest — Test interactive Python examples
unittest — Unit testing framework
[Link] — mock object library
[Link] — getting started
test — Regression tests package for Python
[Link] — Utilities for the Python test suite
[Link].socket_helper — Utilities for socket tests
[Link].script_helper — Utilities for the Python execution tests
[Link].bytecode_helper — Support tools for testing correct bytecode generation
[Link].threading_helper — Utilities for threading tests
[Link].os_helper — Utilities for os tests
[Link].import_helper — Utilities for import tests
[Link].warnings_helper — Utilities for warnings tests
Debugging and Profiling
Audit events table
bdb — Debugger framework
faulthandler — Dump the Python traceback
pdb — The Python Debugger
The Python Profilers
timeit — Measure execution time of small code snippets
trace — Trace or track Python statement execution
tracemalloc — Trace memory allocations
Software Packaging and Distribution
ensurepip — Bootstrapping the pip installer
venv — Creation of virtual environments
zipapp — Manage executable Python zip archives
Python Runtime Services
sys — System-specific parameters and functions
[Link] — Execution event monitoring
sysconfig — Provide access to Python’s configuration information
builtins — Built-in objects
[Link] 6/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
__main__ — Top-level code environment
warnings — Warning control
dataclasses — Data Classes
contextlib — Utilities for with -statement contexts
abc — Abstract Base Classes
atexit — Exit handlers
traceback — Print or retrieve a stack traceback
__future__ — Future statement definitions
gc — Garbage Collector interface
inspect — Inspect live objects
annotationlib — Functionality for introspecting annotations
site — Site-specific configuration hook
Custom Python Interpreters
code — Interpreter base classes
codeop — Compile Python code
Importing Modules
zipimport — Import modules from Zip archives
pkgutil — Package extension utility
modulefinder — Find modules used by a script
runpy — Locating and executing Python modules
importlib — The implementation of import
[Link] – Package resource reading, opening and access
[Link] – Abstract base classes for resources
[Link] – Accessing package metadata
The initialization of the [Link] module search path
Python Language Services
ast — Abstract syntax trees
symtable — Access to the compiler’s symbol tables
token — Constants used with Python parse trees
keyword — Testing for Python keywords
tokenize — Tokenizer for Python source
tabnanny — Detection of ambiguous indentation
pyclbr — Python module browser support
py_compile — Compile Python source files
compileall — Byte-compile Python libraries
dis — Disassembler for Python bytecode
pickletools — Tools for pickle developers
MS Windows Specific Services
msvcrt — Useful routines from the MS VC++ runtime
winreg — Windows registry access
winsound — Sound-playing interface for Windows
Unix-specific services
shlex — Simple lexical analysis
posix — The most common POSIX system calls
pwd — The password database
grp — The group database
[Link] 7/8
22/06/2026, 13:05 The Python Standard Library — Python 3.14.6 documentation
termios— POSIX style tty control
tty — Terminal control functions
pty — Pseudo-terminal utilities
fcntl — The fcntl and ioctl system calls
resource — Resource usage information
syslog — Unix syslog library routines
Modules command-line interface (CLI)
Superseded Modules
getopt — C-style parser for command line options
Removed Modules
Security Considerations
[Link] 8/8