All Topics
HTML
CSS
JavaScript
APIs
Python3 Language
Python3 Library
Python 3 Standard Library
Overview Articles
Python 3 Standard Library Reference
A gateway to the Python Standard Library reference material.
Articles by Category
asynchronous i/o
asyncio — Asynchronous I/O
Coroutines and Tasks
Developing with asyncio
Event Loop
Exceptions
Futures
High-level API Index
Low-level API Index
Platform Support
Policies
Queues
Streams
Subprocesses
Synchronization Primitives
Transports and Protocols
binary data
codecs — Codec registry and base classes
struct — Interpret bytes as packed binary data
built-in constants
Built-in Constants
built-in exceptions
Built-in Exceptions
built-in functions
Built-in Functions
built-in types
Built-in Types
concurrent execution
_thread — Low-level threading API
concurrent.futures — Launching parallel tasks
contextvars — Context Variables
multiprocessing — Process-based parallelism
multiprocessing.shared_memory — Provides shared memory for direct access across processes
queue — A synchronized queue class
sched — Event scheduler
subprocess — Subprocess management
The concurrent package
threading — Thread-based parallelism
cryptography
hashlib — Secure hashes and message digests
hmac — Keyed-Hashing for Message Authentication
secrets — Generate secure random numbers for managing secrets
data compression
bz2 — Support for bzip2 compression
gzip — Support for gzip files
lzma — Compression using the LZMA algorithm
tarfile — Read and write tar archive files
zipfile — Work with ZIP archives
zlib — Compression compatible with gzip
data persistence
copyreg — Register pickle support functions
dbm — Interfaces to Unix “databases”
marshal — Internal Python object serialization
pickle — Python object serialization
shelve — Python object persistence
sqlite3 — DB-API 2.0 interface for SQLite databases
data types
array — Efficient arrays of numeric values
bisect — Array bisection algorithm
calendar — General calendar-related functions
collections — Container datatypes
collections.abc — Abstract Base Classes for Containers
copy — Shallow and deep copy operations
datetime — Basic date and time types
enum — Support for enumerations
graphlib — Functionality to operate with graph-like structures
heapq — Heap queue algorithm
pprint — Data pretty printer
reprlib — Alternate repr() implementation
types — Dynamic type creation and names for built-in types
weakref — Weak references
zoneinfo — IANA time zone support
debugging & 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
development tools
doctest — Test interactive Python examples
pydoc — Documentation generator and online help system
Python Development Mode
test — Regression tests package for Python
typing — Support for type hints
unittest — Unit testing framework
unittest.mock — mock object library
email
email.charset: Representing character sets
email.contentmanager: Managing MIME Content
email.encoders: Encoders
email.errors: Exception and Defect classes
email.generator: Generating MIME documents
email.header: Internationalized headers
email.headerregistry: Custom Header Objects
email.iterators: Iterators
email.message.Message: Representing an email message using the compat32 API
email.message: Representing an email message
email.mime: Creating email and MIME objects from scratch
email.parser: Parsing email messages
email.policy: Policy Objects
email.utils: Miscellaneous utilities
email: Examples
file & directory access
File and Directory Access
filecmp — File and Directory Comparisons
fileinput — Iterate over lines from multiple input streams
fnmatch — Unix filename pattern matching
glob — Unix style pathname pattern expansion
linecache — Random access to text lines
os.path — Common pathname manipulations
pathlib — Object-oriented filesystem paths
shutil — High-level file operations
stat — Interpreting stat() results
tempfile — Generate temporary files and directories
file formats
configparser — Configuration file parser
csv — CSV File Reading and Writing
netrc — netrc file processing
plistlib — Generate and parse Apple .plist files
xdrlib — Encode and decode XDR data
frameworks
cmd — Support for line-oriented command interpreters
shlex — Simple lexical analysis
turtle — Turtle graphics
functional programming
functools — Higher-order functions and operations on callable objects
itertools — Functions creating iterators for efficient looping
operator — Standard operators as functions
importing
importlib — The implementation of import
modulefinder — Find modules used by a script
pkgutil — Package extension utility
runpy — Locating and executing Python modules
Using importlib.metadata
zipimport — Import modules from Zip archives
input/ouput
select — Waiting for I/O completion
selectors — High-level I/O multiplexing
internationalization
gettext — Multilingual internationalization services
locale — Internationalization services
internet
cgi — Common Gateway Interface support
cgitb — Traceback manager for CGI scripts
ftplib — FTP protocol client
http — HTTP modules
http.client — HTTP protocol client
http.cookiejar — Cookie handling for HTTP clients
http.cookies — HTTP state management
http.server — HTTP servers
imaplib — IMAP4 protocol client
ipaddress — IPv4/IPv6 manipulation library
nntplib — NNTP protocol client
poplib — POP3 protocol client
smtpd — SMTP Server
smtplib — SMTP protocol client
socketserver — A framework for network servers
telnetlib — Telnet client
urllib — URL handling modules
urllib.error — Exception classes raised by urllib.request
urllib.parse — Parse URLs into components
urllib.request — Extensible library for opening URLs
urllib.robotparser — Parser for robots.txt
uuid — UUID objects according to RFC 4122
webbrowser — Convenient Web-browser controller
wsgiref — WSGI Utilities and Reference Implementation
xmlrpc — XMLRPC server and client modules
xmlrpc.client — XML-RPC client access
xmlrpc.server — Basic XML-RPC servers
internet data
base64 — Base16, Base32, Base64, Base85 Data Encodings
binascii — Convert between binary and ASCII
binhex — Encode and decode binhex4 files
email — An email and MIME handling package
json — JSON encoder and decoder
mailbox — Manipulate mailboxes in various formats
mailcap — Mailcap file handling
mimetypes — Map filenames to MIME types
quopri — Encode and decode MIME quoted-printable data
uu — Encode and decode uuencode files
interpreters
code — Interpreter base classes
codeop — Compile Python code
language
ast — Abstract Syntax Trees
compileall — Byte-compile Python libraries
dis — Disassembler for Python bytecode
keyword — Testing for Python keywords
parser — Access Python parse trees
pickletools — Tools for pickle developers
py_compile — Compile Python source files
pyclbr — Python module browser support
symbol — Constants used with Python parse trees
symtable — Access to the compiler’s symbol tables
tabnanny — Detection of ambiguous indentation
token — Constants used with Python parse trees
tokenize — Tokenizer for Python source
logging
logging — Logging facility for Python
logging.config — Logging configuration
logging.handlers — Logging handlers
ms windows
msilib — Read and write Microsoft Installer files
msvcrt — Useful routines from the MS VC++ runtime
winreg — Windows registry access
winsound — Sound-playing interface for Windows
multimedia
aifc — Read and write AIFF and AIFC files
audioop — Manipulate raw audio data
chunk — Read IFF chunked data
colorsys — Conversions between color systems
imghdr — Determine the type of an image
ossaudiodev — Access to OSS-compatible audio devices
sndhdr — Determine type of sound file
wave — Read and write WAV files
networking & interprocess communication
asynchat — Asynchronous socket command/response handler
asyncore — Asynchronous socket handler
mmap — Memory-mapped file support
signal — Set handlers for asynchronous events
socket — Low-level networking interface
ssl — TLS/SSL wrapper for socket objects
numeric & mathematical
cmath — Mathematical functions for complex numbers
decimal — Decimal fixed point and floating point arithmetic
fractions — Rational numbers
math — Mathematical functions
numbers — Numeric abstract base classes
random — Generate pseudo-random numbers
statistics — Mathematical statistics functions
operating system
argparse — Parser for command-line options, arguments and sub-commands
ctypes — A foreign function library for Python
curses — Terminal handling for character-cell displays
curses.ascii — Utilities for ASCII characters
curses.panel — A panel stack extension for curses
errno — Standard errno system symbols
getopt — C-style parser for command line options
getpass — Portable password input
io — Core tools for working with streams
os — Miscellaneous operating system interfaces
platform — Access to underlying platform’s identifying data
time — Time access and conversions
runtime
__future__ — Future statement definitions
__main__ — Top-level script environment
abc — Abstract Base Classes
atexit — Exit handlers
builtins — Built-in objects
contextlib — Utilities for with-statement contexts
dataclasses — Data Classes
gc — Garbage Collector interface
inspect — Inspect live objects
site — Site-specific configuration hook
sys — System-specific parameters and functions
sysconfig — Provide access to Python’s configuration information
traceback — Print or retrieve a stack traceback
warnings — Warning control
software packaging & distribution
distutils — Building and installing Python modules
ensurepip — Bootstrapping the pip installer
venv — Creation of virtual environments
zipapp — Manage executable Python zip archives
structured markup
html — HyperText Markup Language support
html.entities — Definitions of HTML general entities
html.parser — Simple HTML and XHTML parser
XML Processing Modules
xml.dom — The Document Object Model API
xml.dom.minidom — Minimal DOM implementation
xml.dom.pulldom — Support for building partial DOM trees
xml.etree.ElementTree — The ElementTree XML API
xml.parsers.expat — Fast XML parsing using Expat
xml.sax — Support for SAX2 parsers
xml.sax.handler — Base classes for SAX handlers
xml.sax.saxutils — SAX Utilities
xml.sax.xmlreader — Interface for XML parsers
text processing
difflib — Helpers for computing deltas
re — Regular expression operations
readline — GNU readline interface
rlcompleter — Completion function for GNU readline
string — Common string operations
stringprep — Internet String Preparation
textwrap — Text wrapping and filling
unicodedata — Unicode Database
tk
IDLE
Other Graphical User Interface Packages
tkinter — Python interface to Tcl/Tk
Tkinter Dialogs
tkinter.colorchooser — Color choosing dialog
tkinter.dnd — Drag and drop support
tkinter.font — Tkinter font wrapper
tkinter.messagebox — Tkinter message prompts
tkinter.scrolledtext — Scrolled Text Widget
tkinter.tix — Extension widgets for Tk
tkinter.ttk — Tk themed widgets
unix
crypt — Function to check Unix passwords
fcntl — The fcntl and ioctl system calls
grp — The group database
nis — Interface to Sun’s NIS (Yellow Pages)
pipes — Interface to shell pipelines
posix — The most common POSIX system calls
pty — Pseudo-terminal utilities
pwd — The password database
resource — Resource usage information
spwd — The shadow password database
syslog — Unix syslog library routines
termios — POSIX style tty control
tty — Terminal control functions