Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Python Tutorial

Python HOME Python Intro Python Get Started Python Syntax Python Comments Python Variables Python Data Types Python Numbers Python Casting Python Strings Python Booleans Python Operators Python Lists Python Tuples Python Sets Python Dictionaries Python If...Else Python Match Python While Loops Python For Loops Python Functions Python Decorators Python Range Python Lambda Python Arrays Python OOP Python Classes/Objects Python Inheritance Python Iterators Python Polymorphism Python Scope Python Modules Python Dates Python Math Python JSON Python RegEx Python PIP Python Try...Except Python String Formatting Python None Python User Input Python VirtualEnv

File Handling

Python File Handling Python Read Files Python Write/Create Files Python Delete Files

Python Modules

NumPy Tutorial Pandas Tutorial SciPy Tutorial Django Tutorial

Python Matplotlib

Matplotlib Intro Matplotlib Get Started Matplotlib Pyplot Matplotlib Plotting Matplotlib Markers Matplotlib Line Matplotlib Labels Matplotlib Grid Matplotlib Subplot Matplotlib Scatter Matplotlib Bars Matplotlib Histograms Matplotlib Pie Charts

Machine Learning

Getting Started Mean Median Mode Standard Deviation Percentile Data Distribution Normal Data Distribution Scatter Plot Linear Regression Polynomial Regression Multiple Regression Scale Train/Test Decision Tree Confusion Matrix Hierarchical Clustering Logistic Regression Grid Search Categorical Data K-means Bootstrap Aggregation Cross Validation AUC - ROC Curve K-nearest neighbors

Python DSA

Python DSA Lists and Arrays Stacks Queues Linked Lists Hash Tables Trees Binary Trees Binary Search Trees AVL Trees Graphs Linear Search Binary Search Bubble Sort Selection Sort Insertion Sort Quick Sort Counting Sort Radix Sort Merge Sort

Python MySQL

MySQL Get Started MySQL Create Database MySQL Create Table MySQL Insert MySQL Select MySQL Where MySQL Order By MySQL Delete MySQL Drop Table MySQL Update MySQL Limit MySQL Join

Python MongoDB

MongoDB Get Started MongoDB Create DB MongoDB Collection MongoDB Insert MongoDB Find MongoDB Query MongoDB Sort MongoDB Delete MongoDB Drop Collection MongoDB Update MongoDB Limit

Python Reference

Python Overview Python Built-in Functions Python String Methods Python List Methods Python Dictionary Methods Python Tuple Methods Python Set Methods Python File Methods Python Keywords Python Exceptions Python Glossary

Module Reference

Built-in Modules Random Module Requests Module Statistics Module Math Module cMath Module

Python How To

Remove List Duplicates Reverse a String Add Two Numbers

Python Examples

Python Examples Python Compiler Python Exercises Python Quiz Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training

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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
jsonEncode and decode JSON data (JavaScript Object Notation).2.6

K

Module Description Introduced
keywordTest for Python keywords; list all keywords.

L

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

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

R

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
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

Module Description Introduced
venvCreate lightweight isolated Python environments.3.3

W

Module Description Introduced
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

X

Module Description Introduced
xdrlibPack and unpack XDR data (External Data Representation).2.0
xmlXML processing package.2.0
xmlrpcXML-RPC client and server package.2.2

Z

Module Description Introduced
zipappCreate executable Python zip applications.3.5
zipfileRead and write ZIP archives.2.0
zipimportImport modules from ZIP archives.2.3
zlibCompress and decompress data using zlib.2.0
zoneinfoIANA time zone support for datetime.3.9

Note: This page lists Python 3.13 Standard Library modules. Some modules are platform-specific (Unix/Windows) or optional at build time.


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.