Python Standard Library
The "batteries included" modules that ship with every Python installation, grouped by what they do.
Before installing a package, check here — the standard library covers maths, files, dates, data formats, networking, concurrency, testing and more. The official reference is docs.python.org/3/library.
Sub-topics (15)
Numbers and Mathematics
math, cmath, decimal, fractions, statistics, random and secrets.
Data Structures and Algorithms
collections, heapq, bisect, array, copy, enum and itertools/functools/operator.
Typing and Program Structure
dataclasses, typing, abc and contextlib.
Files, Paths and the Operating System
pathlib, os, sys, shutil, glob, fnmatch, tempfile, filecmp, stat and io.
Dates and Time
time, datetime, calendar and zoneinfo.
Logging, Debugging and Introspection
logging, warnings, traceback, inspect, gc and weakref.
Data Persistence and Formats
pickle, shelve, sqlite3, dbm, json, csv, tomllib, configparser, xml and html.
Internet Data and Encoding
email, base64, binascii, uuid and ipaddress.
Cryptography and Hashing
hashlib, hmac and ssl.
Networking and Internet Protocols
socket, socketserver, select, selectors, urllib, http, ftplib, smtplib, imaplib and webbrowser.
Concurrency and Processes
asyncio, threading, multiprocessing, concurrent.futures, subprocess, queue, signal and shared memory.
Command Line and Terminal
argparse, getpass, cmd and curses.
Testing, Debugging and Profiling
unittest, doctest, pdb, timeit, cProfile, pstats and tracemalloc.
Packaging, Imports and Code Tools
venv, ensurepip, importlib, ast, dis, tokenize, compileall, platform and ctypes.
Compression and Archives
zipfile, tarfile, gzip, bz2, lzma and zlib.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.