Functional Programming Modules#
The modules described in this chapter provide functions and classes that support a functional programming style, and general operations on callables.
The following modules are documented in this chapter:
Site Navigation
Section Navigation
string
— Common string operations
re
— Regular expression operations
difflib
— Helpers for computing deltas
textwrap
— Text wrapping and filling
unicodedata
— Unicode Database
stringprep
— Internet String Preparation
readline
— GNU readline interface
rlcompleter
— Completion function for GNU readline
datetime
— Basic date and time types
zoneinfo
— IANA time zone support
calendar
— General calendar-related functions
collections
— Container datatypes
collections.abc
— Abstract Base Classes for Containers
heapq
— Heap queue algorithm
bisect
— Array bisection algorithm
array
— Efficient arrays of numeric values
weakref
— Weak references
types
— Dynamic type creation and names for built-in types
copy
— Shallow and deep copy operations
pprint
— Data pretty printer
reprlib
— Alternate
repr()
implementation
enum
— Support for enumerations
graphlib
— Functionality to operate with graph-like structures
pathlib
— Object-oriented filesystem paths
os.path
— Common pathname manipulations
fileinput
— Iterate over lines from multiple input streams
stat
— Interpreting
stat()
results
filecmp
— File and Directory Comparisons
tempfile
— Generate temporary files and directories
glob
— Unix style pathname pattern expansion
fnmatch
— Unix filename pattern matching
linecache
— Random access to text lines
shutil
— High-level file operations
os
— Miscellaneous operating system interfaces
io
— Core tools for working with streams
time
— Time access and conversions
argparse
— Parser for command-line options, arguments and sub-commands
getopt
— C-style parser for command line options
logging
— Logging facility for Python
logging.config
— Logging configuration
logging.handlers
— Logging handlers
getpass
— Portable password input
platform
— Access to underlying platform’s identifying data
errno
— Standard errno system symbols
ctypes
— A foreign function library for Python
threading
— Thread-based parallelism
multiprocessing
— Process-based parallelism
multiprocessing.shared_memory
— Provides shared memory for direct access across processes
concurrent
package
concurrent.futures
— Launching parallel tasks
subprocess
— Subprocess management
sched
— Event scheduler
queue
— A synchronized queue class
contextvars
— Context Variables
_thread
— Low-level threading API
email
— An email and MIME handling package
email.message
: Representing an email message
email.parser
: Parsing email messages
email.generator
: Generating MIME documents
email.policy
: Policy Objects
email.errors
: Exception and Defect classes
email.headerregistry
: Custom Header Objects
email.contentmanager
: Managing MIME Content
email
: Examples
email.message.Message
: Representing an email message using the
compat32
API
email.mime
: Creating email and MIME objects from scratch
email.header
: Internationalized headers
email.charset
: Representing character sets
email.encoders
: Encoders
email.utils
: Miscellaneous utilities
email.iterators
: Iterators
json
— JSON encoder and decoder
mailcap
— Mailcap file handling
mailbox
— Manipulate mailboxes in various formats
mimetypes
— Map filenames to MIME types
base64
— Base16, Base32, Base64, Base85 Data Encodings
binhex
— Encode and decode binhex4 files
binascii
— Convert between binary and ASCII
quopri
— Encode and decode MIME quoted-printable data
html
— HyperText Markup Language support
html.parser
— Simple HTML and XHTML parser
html.entities
— Definitions of HTML general entities
xml.etree.ElementTree
— The ElementTree XML API
xml.dom
— The Document Object Model API
xml.dom.minidom
— Minimal DOM implementation
xml.dom.pulldom
— Support for building partial DOM trees
xml.sax
— Support for SAX2 parsers
xml.sax.handler
— Base classes for SAX handlers
xml.sax.saxutils
— SAX Utilities
xml.sax.xmlreader
— Interface for XML parsers
xml.parsers.expat
— Fast XML parsing using Expat
webbrowser
— Convenient web-browser controller
wsgiref
— WSGI Utilities and Reference Implementation
urllib
— URL handling modules
urllib.request
— Extensible library for opening URLs
urllib.parse
— Parse URLs into components
urllib.error
— Exception classes raised by urllib.request
urllib.robotparser
— Parser for robots.txt
http
— HTTP modules
http.client
— HTTP protocol client
ftplib
— FTP protocol client
poplib
— POP3 protocol client
imaplib
— IMAP4 protocol client
smtplib
— SMTP protocol client
uuid
— UUID objects according to
RFC 4122
socketserver
— A framework for network servers
http.server
— HTTP servers
http.cookies
— HTTP state management
http.cookiejar
— Cookie handling for HTTP clients
xmlrpc
— XMLRPC server and client modules
xmlrpc.client
— XML-RPC client access
xmlrpc.server
— Basic XML-RPC servers
ipaddress
— IPv4/IPv6 manipulation library
typing
— Support for type hints
pydoc
— Documentation generator and online help system
doctest
— Test interactive Python examples
unittest
— Unit testing framework
unittest.mock
— mock object library
unittest.mock
— getting started
test
— Regression tests package for Python
sys
— System-specific parameters and functions
sysconfig
— Provide access to Python’s configuration information
builtins
— Built-in objects
__main__
— Top-level code environment
warnings
— Warning control
dataclasses
— Data Classes
contextlib
— Utilities for
with
-statement contexts
abc
— Abstract Base Classes
atexit
— Exit handlers
traceback
— Print or retrieve a stack traceback
__future__
— Future statement definitions
gc
— Garbage Collector interface
inspect
— Inspect live objects
site
— Site-specific configuration hook
ast
— Abstract Syntax Trees
symtable
— Access to the compiler’s symbol tables
token
— Constants used with Python parse trees
keyword
— Testing for Python keywords
tokenize
— Tokenizer for Python source
tabnanny
— Detection of ambiguous indentation
pyclbr
— Python module browser support
py_compile
— Compile Python source files
compileall
— Byte-compile Python libraries
dis
— Disassembler for Python bytecode
pickletools
— Tools for pickle developers
posix
— The most common POSIX system calls
pwd
— The password database
grp
— The group database
termios
— POSIX style tty control
tty
— Terminal control functions
pty
— Pseudo-terminal utilities
fcntl
— The
fcntl
and
ioctl
system calls
resource
— Resource usage information
syslog
— Unix syslog library routines
aifc
— Read and write AIFF and AIFC files
asynchat
— Asynchronous socket command/response handler
asyncore
— Asynchronous socket handler
audioop
— Manipulate raw audio data
cgi
— Common Gateway Interface support
cgitb
— Traceback manager for CGI scripts
chunk
— Read IFF chunked data
crypt
— Function to check Unix passwords
imghdr
— Determine the type of an image
imp
— Access the
import
internals
msilib
— Read and write Microsoft Installer files
nntplib
— NNTP protocol client
nis
— Interface to Sun’s NIS (Yellow Pages)
optparse
— Parser for command line options
ossaudiodev
— Access to OSS-compatible audio devices
pipes
— Interface to shell pipelines
smtpd
— SMTP Server
sndhdr
— Determine type of sound file
spwd
— The shadow password database
sunau
— Read and write Sun AU files
telnetlib
— Telnet client
uu
— Encode and decode uuencode files
xdrlib
— Encode and decode XDR data
The modules described in this chapter provide functions and classes that support a functional programming style, and general operations on callables.
The following modules are documented in this chapter: