bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Files, Modules, and the Standard Library
Python•Files, Modules, and the Standard Library

Python Python Built-in Modules

Flash cards

Review the key moves

1/3
Core idea

What is the main idea behind Python Python Built-in Modules?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Order

Put the learning moves in the order that makes the concept easiest to apply.

These modules are available without extra installation (some are platform-dependent).
This page lists the built-in modules that ship with the Python 3.
Python Python Built-in Modules

This page lists the built-in modules that ship with the Python 3.13 Standard Library.

These modules are available without extra installation (some are platform-dependent).

A

ModuleDescriptionIntroduced
abcTools for defining Abstract Base Classes (interfaces for Python classes).2.6
aifcRead and write AIFF/AIFF-C audio files.1.5.2
argparseParse command line arguments and create user-friendly CLIs.2.7
arrayEfficient arrays of basic numeric types (compact alternative to lists).1.0
astWork with Python code as an Abstract Syntax Tree (analyze or transform code).2.6
asyncioWrite concurrent code using the async/await syntax (event loop, tasks, IO).3.4
atexitRegister functions to run automatically when the program exits.2.0

B

ModuleDescriptionIntroduced
base64Encode and decode data using Base16, Base32, Base64, etc.2.0
bdbDebugger framework used by pdb (implements the core debugging logic).-
binasciiConvert between binary and ASCII (hex, base64 helpers at C speed).2.0
bisectMaintain sorted lists; insert and search with binary search.2.0
builtinsAccess Python's built-in objects like len, range, and exceptions.3.0
bz2Read and write bzip2-compressed files and streams.2.3

C

ModuleDescriptionIntroduced
calendarWork with dates as calendars; print text calendars and compute month info.2.0
cgiHelpers for Common Gateway Interface (legacy web server scripts).2.0
cgitbPretty tracebacks for CGI scripts (HTML formatted error reports).-
cmdBuild simple line-oriented command interpreters (REPL-like shells).2.0
codeRun an interactive interpreter or embed one in your program.2.0
codecsText encodings and decoding/encoding helpers.2.0
codeopCompile Python code objects conditionally (used by code editors and shells).2.0
collectionsHigh-performance container datatypes like deque, Counter, namedtuple.2.4
colorsysConvert between color systems: RGB, YIQ, HLS, HSV.2.0
concurrentConcurrency framework (futures) for running callables asynchronously.3.2
configparserRead and write INI-style configuration files.3.0
contextlibUtilities for context managers and the with-statement.2.5
contextvarsContext-local storage for async code (like thread-local, but for tasks).3.7
copyShallow and deep copy operations for Python objects.2.0
copyregRegister custom pickling functions for complex objects.3.0
csvRead and write CSV files (comma-separated values) with ease.2.3
ctypesCall C libraries and work with C-compatible data types.2.5
cursesTerminal handling for character-cell UIs (Unix-like systems only).2.0

D

ModuleDescriptionIntroduced
dataclassesDecorator and helpers for classes that store data (auto-generate init, repr, etc.).3.7
datetimeDates, times, time zones, and timedeltas made simple and precise.2.3
dbmFamily of simple on-disk key/value databases (backed by platform libs).2.0
decimalFixed-point and floating decimal arithmetic for money and exact math.2.4
difflibCompare sequences and create human-readable diffs.2.1
disDisassemble Python bytecode for inspection and debugging.2.0
doctestTest examples embedded in docstrings (keeps docs and code in sync).2.1

E

ModuleDescriptionIntroduced
emailParse, build, and send email messages (headers, MIME, attachments).2.2
encodingsImplementation of text encodings used by Python's codec system.2.0
ensurepipBootstraps pip into a Python installation.3.4
enumDefine enumerations (named constants) with nice semantics.3.4
errnoStandard error number constants from the OS.2.0

F

ModuleDescriptionIntroduced
faulthandlerDump Python tracebacks on a crash or on demand (helps debug hard faults).3.3
filecmpCompare files and directories to see what changed.2.0
fileinputLoop over lines from stdin or a list of files as a single stream.2.0
fnmatchMatch filenames using shell-style wildcards.2.0
fractionsRational numbers (Fractions) for exact arithmetic.2.6
ftplibFTP client library for transferring files.2.0
functoolsHigher-order functions and utilities (lru_cache, partial, wraps, etc.).2.5

G

ModuleDescriptionIntroduced
gcControl the garbage collector and inspect tracked objects.2.0
getoptParse command-line options (POSIX-style).1.5.2
getpassPrompt for a password without echoing it to the console.2.0
gettextInternationalization (i18n) support for translating messages.2.3
globFind pathnames matching a pattern like *.py.2.0
graphlibTopological sorting utilities for dependency graphs.3.9
gzipRead and write gzip-compressed files and streams.2.0

H

ModuleDescriptionIntroduced
hashlibSecure hashes and message digests (SHA, MD5, BLAKE2, etc.).2.5
heapqHeap queue (priority queue) algorithms on plain lists.2.3
hmacKeyed-hash message authentication codes (HMAC).2.2
htmlHTML helpers (escape/unescape text).3.2
httpHTTP modules package (client, server, cookies).3.0

I

ModuleDescriptionIntroduced
idlelibSupport for the IDLE interactive Python environment.-
imaplibIMAP4 client library for accessing email servers.2.0
imghdrDetermine the type of an image file.2.0
impAccess the import internals (deprecated; use importlib ).-
importlibProgrammatic interface to Python's import mechanism.3.1
inspectInspect live objects such as modules, classes, and functions.-
ioInput/Output streams and buffering (text and binary).2.6

J

ModuleDescriptionIntroduced
jsonEncode and decode JSON data (JavaScript Object Notation).2.6

K

ModuleDescriptionIntroduced
keywordTest for Python keywords; list all keywords.-

L

ModuleDescriptionIntroduced
linecacheRead text lines from files with random access.2.0
localeInternationalization (i18n) support for formatting numbers and dates.2.0
loggingFlexible event logging system with various handlers.2.3
lzmaCompression using the LZMA algorithm (xz format).3.3

M

ModuleDescriptionIntroduced
mailboxWork with various mailbox formats (mbox, Maildir, etc.).2.3
mailcapRead mailcap files (MIME handlers configuration).2.0
marshalRead and write Python values in a binary format (for .pyc internals).-
mathFast math functions: trigonometry, logarithms, constants, etc.-
mimetypesGuess a file's type based on its filename or URL.2.0
mmapMemory-map files for efficient random access.2.0
modulefinderFind modules used by a script (dependency scanning).-
msilibCreate and read Microsoft Installer (.msi) files (Windows only).-
msvcrtAccess to Microsoft C runtime routines (Windows only).-
multiprocessingRun code in parallel using processes (bypass the GIL).2.6

N

ModuleDescriptionIntroduced
netrcParse .netrc files for machine login credentials.2.0
nntplibClient for NNTP (Usenet) news servers.2.0
numbersAbstract base classes for numeric types.2.6
nisInterface to Sun's NIS (Yellow Pages) service (Unix platforms).-
ntpathWindows path operations (used by os.path on Windows).2.0

O

ModuleDescriptionIntroduced
operatorFunctional interface to operators (add, mul, itemgetter, attrgetter).1.5.2
optparseDeprecated parser for command line options (use argparse).2.3
osOperating system interfaces: files, environment, processes.-

P

ModuleDescriptionIntroduced
pathlibObject-oriented filesystem paths.3.4
pdbInteractive debugger for Python programs.2.0
pickleSerialize and deserialize Python objects (not secure against untrusted data).2.0
pickletoolsTools for analyzing pickled data.2.3
pipesPipe shell commands together (Unix).2.0
pkgutilUtilities for packages: walk packages, find loaders, etc.2.3
platformAccess to underlying platform information.2.3
plistlibRead and write Apple .plist files.2.6
poplibPOP3 email client.2.0
posixPOSIX APIs (Unix-only, low-level).2.0
pprintPretty-print Python data structures.2.0
profileDeterministic profiling of Python programs.2.0
pstatsWork with profiling results produced by profile/cProfile.2.0
ptyPseudo-terminal utilities (Unix).2.0
pyclbrRead module to get class browser information without importing it.2.0
pydocGenerate and view Python documentation.2.1
py_compileCompile Python source files to bytecode.2.0

Q

ModuleDescriptionIntroduced
queueThread-safe FIFO/LIFO/priority queues.2.6
quopriEncode/decode MIME quoted-printable data.2.0

R

ModuleDescriptionIntroduced
randomGenerate pseudo-random numbers for various distributions.2.0
reRegular expression operations for pattern matching in strings.2.0
reprlibSafe string representations for large or recursive structures.3.0
resourceControl and query system resource limits (Unix).2.0
rlcompleterTab-completion support for the interactive interpreter.2.0
runpyRun modules as scripts (like python -m).2.5

S

ModuleDescriptionIntroduced
schedEvent scheduler for running functions at specific times.2.0
secretsGenerate cryptographically strong random numbers and tokens.3.6
selectLow-level I/O multiplexing (select, poll, epoll, kqueue).2.0
selectorsHigh-level I/O multiplexing built on select module.3.4
shelveSimple persistent storage for Python objects (dict-like API).2.0
shlexParse shell-like syntaxes into tokens.2.0
shutilHigh-level file operations: copy, move, archive, disk usage.2.0
signalSet handlers for asynchronous signals.2.0
siteSite-specific configuration hook that runs at startup.2.0
smtplibSend emails using the SMTP protocol.2.0
socketLow-level networking interface.2.0
socketserverFramework for network servers (TCP/UDP).3.0
sqlite3Built-in lightweight SQL database (SQLite).2.5
sslTLS/SSL wrapper for secure network connections.2.6
statConstants and helpers for interpreting os.stat() results.2.0
statisticsBasic statistics (mean, median, stdev).3.4
stringCommon string constants and helpers.2.0
stringprepString preparation for internet protocols (IDNA).2.3
structConvert between Python values and C structs packed as bytes.2.0
subprocessSpawn new processes and connect to their input/output/error pipes.2.4
sunauRead and write Sun AU audio files.2.0
symtableAccess the compiler's internal symbol tables.2.6
sysAccess to interpreter variables and functions.-
sysconfigAccess Python's configuration information.3.2

T

ModuleDescriptionIntroduced
tabnannyDetect ambiguous indentation in Python source files.2.0
tarfileRead and write tar archives, including gzip/bz2/xz.2.3
telnetlibTelnet client implementation.2.0
tempfileCreate temporary files and directories safely.2.0
termiosPOSIX terminal control (Unix).2.0
testRegression tests package for the Python standard library.2.0
textwrapWrap and fill text paragraphs.2.3
threadingHigher-level threading interface (locks, events, threads).2.0
timeTime access and conversions.-
timeitMeasure execution time of small code snippets.2.3
tkinterStandard GUI toolkit (Tk interface) package.3.0
tokenToken constants used by the Python tokenizer.2.0
tokenizeTurn Python source into tokens (lexical scanner).2.0
tomllibRead TOML files into Python data structures.3.11
traceTrace program execution and produce coverage reports.2.0
tracebackPrint or retrieve stack traces.2.0
tracemallocTrack memory allocations to find leaks and hotspots.3.4
ttyTerminal control functions (Unix).2.0
turtleSimple graphics library for teaching and fun.2.5
typesNames for built-in types and helper factories.2.0
typingType hints and typing helpers for static analysis and tooling.3.5

U

ModuleDescriptionIntroduced
unicodedataAccess the Unicode Character Database (properties, normalization).2.0
unittestUnit testing framework (xUnit style) for Python.2.1
urllibPackage for working with URLs (requests, parsing, robots).2.0
uuidGenerate universally unique identifiers (UUIDs).2.5

V

ModuleDescriptionIntroduced
venvCreate lightweight isolated Python environments.3.3

W

ModuleDescriptionIntroduced
warningsIssue and control warning messages.2.0
waveRead and write WAV audio files.2.0
weakrefWeak references to objects (avoid reference cycles).2.0
webbrowserOpen URLs in a web browser.2.0
wsgirefWSGI utilities and simple reference server for web apps.2.3

Previous

Python File Open

Next

How to Remove Duplicates From a Python List