Overview of Python Standard Library Modules
This article provides a comprehensive overview of the over 200 modules included in Python’s standard library, organized into categories such as text processing, binary data handling, data types, mathematics, functional programming, file and directory operations, persistence, compression, networking, multimedia, internationalization, and many platform-specific utilities.
Python relies on a powerful standard library that offers built‑in modules for system‑level functions as well as everyday programming tasks, making code portable across platforms.
The standard library is extensive, with most Windows installations bundling the entire collection, while Unix‑like systems often provide it as separate packages.
The modules are grouped into the following categories, each containing several related modules:
Text : string, re, difflib, textwrap, unicodedata, stringprep, readline, rlcompleter.
Binary Data : struct, codecs.
Data Types : datetime, calendar, collections, collections.abc, heapq, bisect, array, weakref, types, copy, pprint, reprlib.
Mathematics : numbers, math, cmath, decimal, fractions, random.
Functional Programming : itertools, functools, operator.
File and Directory : os.path, fileinput, stat, filecmp, tempfile, glob, fnmatch, linecache, shutil, macpath.
Persistence : pickle, copyreg, shelve, marshal, dbm, sqlite3.
Compression : zlib, gzip, bz2, lzma, zipfile, tarfile.
File Formatting : csv, configparser, netrc, xdrlib, plistlib.
Encryption : hashlib, hmac.
Operating System Tools : os, io, time, argparser, optparser, getopt, logging, logging.config, logging.handlers, getpass, curses, curses.textpad, curses.ascii, curses.panel, platform, errno, ctypes.
Concurrency : threading, multiprocessing, concurrent, concurrent.futures, subprocess, sched, queue, select, dummy_threading, _thread, _dummy_thread.
Inter‑Process Communication : socket, ssl, asyncore, asynchat, signal, mmap.
Internet : email, json, mailcap, mailbox, mimetypes, base64, binhex, binascii, quopri, quoted‑printable, uu.
HTML and XML : html, html.parser, html.entities, xml, xml.etree.ElementTree, xml.dom, xml.dom.minidom, xml.dom.pulldom, xml.sax, xml.sax.handler, xml.sax.saxutils, xml.sax.xmlreader, xml.parsers.expat.
Internet Protocols and Support : webbrowser, cgi, cgitb, wsgiref, urllib, urllib.request, urllib.response, urllib.parse, urllib.error, urllib.robotparser, http, http.client, ftplib, poplib, imaplib, nntplib, smtplib, smtpd, telnetlib, uuid, socketserver, http.server, http.cookies, http.cookiejar, xmlrpc, xmlrpc.client, xmlrpc.server, ipaddress.
Multimedia : audioop, aifc, sunau, wave, chunk, colorsys, imghdr, sndhdr, ossaudiodev.
Internationalization : gettext, locale.
Programming Frameworks : turtle, cmd, shlex.
Tk GUI : tkinter, tkinter.ttk, tkinter.tix, tkinter.scrolledtext.
Development Tools : pydoc, doctest, unittest, unittest.mock, test, test.support, venv.
Debugging : bdb, faulthandler, pdb, timeit, trace.
Runtime : sys, sysconfig, builtins, main, warnings, contextlib, abc, atexit, traceback, future, gc, inspect, site, fpectl, distutils.
Interpreter : code, codeop.
Import Modules : imp, zipimport, pkgutil, modulefinder, runpy, importlib.
Python Language : parser, ast, symtable, symbol, token, keyword, tokenize, tabnany, pyclbr, py_compile, compileall, dis, pickletools.
Other : formatter.
Windows‑Specific : msilib, msvcrt, winreg, winsound.
Unix‑Specific : posix, pwd, spwd, grp, crypt, termios, tty, pty, fcntl, pipes, resource, nis, syslog.
For more details, refer to the official Python documentation.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.