Search notes:

Python's standard library

abc abc allows to define abstract base classes.
aifc PEP 594: Deprecated in 3.11
argparse process command line arguments
array An array, in contrast to a list, contains elements that all have the same types.
ast
asynchat PEP 594: Deprecated in 3.6, replaced with asyncio
asyncio create concurrent programs (async and await). Compare with concurrent.futures
asyncore PEP 594: Deprecated in 3.6, replaced with asyncio
atexit atexit provides a register function that is similar to C's oneexit().
audioop PEP 594: Deprecated in 3.11
base64
bdb
binascii
binhex
bisect
builtins
bz2
calendar Functions that allow to output calendars like the unix shell cal command. This module is attributed as quick hack in PEP 594.
cgi Deprecated since 3.11 (see PEP 594).
cgitb PEP 594: Deprecated in 3.11
chunk PEP 594: Deprecated in 3.11
cmath Provides mathematical functions for complex numbers, compare with math.
cmd
code
codecs
codeop
collections
collections.abc collections.abc adds some useful abstract base classes such as Iterable, Container and MutableMapping.
colorsys
compileall
concurrent.futures Compare with asyncio
configparser
contextlib Functionality that is used with and for context managers, for example the contextmanager decorator.
copy
copyreg
crypt PEP 594: Deprecated in 3.11, replaced with legacycrypt, bcrypt, argon2-cffi, hashlib, passlib
csv Read and write CSV files.
ctypes call DLLs or shared libraries
curses Note: there is no curses module for Windows. Use consolelib instead.
curses.ascii
curses.panel
curses.textpad
datetime Date and time calculations
dateutil Provides extensions to datetime
dbm A generic interface to the DBM database (which is able to store simple key/value pairs). Compare with shelve
decimal Replacement for the float type when pricision is important, such as in financial applications.
difflib
dis disassembler for bytecode.
distutils Tools to distribute Python modules. Compare with setuptools. See also PEP 517
doctest doctest finds code-examples in a module's docstring and executes them, typically for testing purposes.
_dummy_thread
dummy_threading
email Manage email messages: MIME and RFC 2822 (See email.message)
ensurepip
enum
errno
faulthandler
fcntl
filecmp
fileinput
fnmatch
formatter
fpectl
fractions Support for rational numbers.
ftplib
functools Used with and for callable objects
__future__ a pseudo module that enables new language features that are not compatible with the current interpreter.
gc control the garbage collector
getopt
getpass Gets a user's login name or prompts for entering a value without echoing it (typically used to enter passwords).
gettext
glob find filenames with wildcards.
grp
gzip
hashlib
heapq
hmac
html
html.entities
html.parser
http Allows to create webservers.
http.client
http.cookiejar
http.cookies
http.server Is Python 2 SimpleHTTPServer merged into http.server in Python 3?
IDLE
imaplib
imghdr PEP 594: Deprecated in 3.11, replaced with filetype, puremagic, python-magic
imp
importlib An interface to the instrinsics of the import statement.
inspect
io
ipaddress
itertools Iterator building blocks.
json to parse JSON data.
keyword
lib2to3 Convert Python 2 scripts to Python 3 scripts. See also the 2to3.py script.
linecache
locale
logging
logging.config
logging.handlers
lzma
macpath
mailbox
mailcap PEP 594: Deprecated in 3.11
__main__
marshall
math Access the standard c library mathematical (floating point) routines, compare with cmath.
mimetypes
mmap
modulefinder
msilib PEP 594: Deprecated in 3.11
msvcrt
multiprocessing
netrc Parses files adhering to the netrc format (like ~/.netrc).
nis PEP 594: Deprecated in 3.11
nntplib PEP 594: Deprecated in 3.11
numbers
operator Exports efficient functions corresponding to Python's intrinsic operators.
optparse Deprecated
os
os.path functions related to files and filename manipulation
ossaudiodev PEP 594: Deprecated in 3.11
parser
pathlib
pdb a simple console-mode debugger
pickle The pickle module allows to serialize arbitrarily complex objects. See also the dbm and shelve libraries.
pickletools
pipes PEP 594: Deprecated in 3.11, replaced with subprocess
pkgutil
platform
plistlib
poplib Compare with the smtplib and email modules
posix
profile
pprint pretty printer, compare with the reprlib and textwrap modules
pstat
pty
pwd
pyclbr
py_compile
pydoc pydoc can create HTML from doc-strings that is located in a module's source code. (Compare with epydoc and Sphinx.
queue
quopri
random Pseudo random number generator and selections. Compare with secrets.
re for regular expressions.
readline Input line editing etc., Apparently not availble on Windows. See also rlcompleter
reprlib Compare with pprint
resource
rlcompleter See also readline.
runpy
sched
secrets Generate random number for cryptographical use (passwords, authentication, security tokens etc.). Compare with the pseudo random number generators of random.
select
selectors
shelve A dictionary-like which allows to persist any object that can also be handled by pickle. Compare with dbm
shlex
shutil shutil contains high-level file operations.
signal
site
smtpd PEP 594: Deprecated in 3.4.7/3.5.4, replaced with aiosmtpd
smtplib compare with poplib and email modules
sndhdr Determines type of a sound file. PEP 594: Deprecated in 3.11, replaced with filetype, puremagic, python-magic
socket
socketserver
spwd PEP 594: Deprecated in 3.11, replaced with python-pam
sqlite3 to access SQLite databases.
ssl
stat
statistics calculate some basic statistical properties (mean, median, variance, etc.)
string
stringprep
struct Read or write binary data.
subprocess
sunau
symbol
symtable
sys to access system specifica.
sysconfig
sysconfig
syslog
tabnanny
tarfile
telnetlib PEP 594: Deprecated in 3.11, replaced with telnetlib3, Exscript`
tempfile
termios
test
test.support
textwrap o wrap text and remove leading space from triple quoted strings.
_thread
threading Support for multi-threaded applications
time
timeit for precise code-execution-duration measurements.
tkinter
tkinter.scrolledtext
tkinter.tix
tkinter.ttk
token
tokenize
trace
traceback Extract, format and print stack traces. Compare with sys.last_traceback, sys.exc_info and sys._current_frames.
tracemalloc
tty
turtle
types
typing Support for type hints (such as Any, Union, Callable, TypeVar and Generic), see also PEP 483 and 484
unicodedata
unittest
unittest.mock
unittest.mock
urllib
urllib.error
urllib.parse
urllib.request
urllib.response
urllib.robotparser
uu PEP 594: Deprecated in 3.11
uuid
venv create virtual environments
warnings
wave Read and write .wav files.
weakref weakref allows to point to object without incrementing their reference counter.
webbrowser
winreg
winsound
wsgiref The reference implementation for WSGI
xdrlib PEP 594: Deprecated in 3.11
XML
xml.dom
xml.dom.minidom
xml.dom.pulldom
xml.etree.ElementTree
xml.parsers.expat
xmlrpc
xmlrpc.client, xmlrpc.server remote procedure calls
xml.sax
xml.sax.handler
xml.sax.saxutils
xml.sax.xmlreader
zipapp
zipfile
zipimport
zlib data compression

Misc

Battery included

The standard-library is/are the batteries of the battery included philosophy of Python.
Referring to the standard-library as «batteries» gave raise to naming PEP 594 «Removing dead batteries from the standard library».

TODO

Built-in libraries

The tuple of of modules that are compiled into the Python interpreter can be obtained with the following snippet:
import sys
for lib in (sorted(sys.builtin_module_names)): print(lib)

See also

Code in the standard library must adhere to PEP 8 (Style Guide for Python Code).
The root directory of the standard library can be determined with sys.prefix.
The special interest group stdlib-sig.

Index