About the Python standard library
As we all know, Python is a language that relies on powerful component libraries to complete corresponding functions. In order to realize various functions conveniently, senior experts have created a variety of tool libraries that are publicly available to the public, and more and more libraries have been used by the public. It has become the standard library of Python due to its wide use and powerful functions.
Today, the Python standard library is very large and provides a wide range of components, as will be shown later in this article. This library contains several built-in modules (written in C) that Python programmers must rely on to implement system-level functions such as file I/O, as well as a large number of modules written in Python that provide solutions to many problems in daily programming. Standard solution. Some of these modules are specifically designed to encourage and enhance the portability of Python programs by abstracting platform-specific functionality into platform-neutral APIs.
Windows version of Python installers usually include the entire standard library and often many additional components. For Unix-like operating systems, Python is usually divided into a series of packages, so you may need to use the package management tools provided by the operating system to obtain some or all optional components.
In addition to this standard library, there are thousands and growing additional components (from individual programs, modules, and software packages to complete application development frameworks) that can be searched and downloaded on the Internet.
directory listing
This article will list the standard libraries under each category in the following order:
-
text
-
binary data
-
type of data
-
math
-
functional programming
-
Files and directories
-
Endurance
-
compression
-
file formatting
-
encryption
-
operating system tools
-
concurrent
-
interprocess communication
-
internet
-
HTML to XML
-
Internet protocols and support
-
multimedia
-
globalization
-
programming framework
-
Tk graphical user interface
-
development tools
-
debug
-
Runtime
-
interpreter
-
Import module
-
Python language
-
other
-
Windows related
-
Unix related
text
string: Common string operations
re: regular expression operation
difflib: Difference calculation tool
textwrap: text filling
unicodedata: Unicode character database
stringprep: Internet string preparation tool
readline: GNU line-by-line reading interface
rlcompleter: GNU line-by-line reading implementation function
binary data
struct: parses bytes into packed binary data
codecs: Registry and base class codecs
type of data
datetime: Date and time based tools
calendar: universal month function
collections: container data type
collections.abc: container virtual base class
heapq: heap queue algorithm
bisect: Array bisection algorithm
array: efficient numeric array
weakref: weak reference
types: Dynamic creation and naming of built-in types
copy: shallow copy and deep copy
pprint: formatted output
reprlib: implementation of alternate repr()
math
numbers: virtual base class for numerical values
math: mathematical function
cmath: mathematical function for complex numbers
decimal: fixed-point and floating-point calculations
fractions: rational numbers
random: generate pseudo-random numbers
functional programming
itertools: Generate iterators for efficient loops
functools: higher-order functions and operations on callable objects
operator: standard operation for functions
Files and directories
os.path: Universal pathname control
fileinput: iterate over lines from multiple input streams
stat: Interpret the results of stat()
filecmp: comparison function between files and directories
tempfile: generate temporary files and directories
glob: extension to Unix-style pathname format
fnmatch: Comparison of Unix-style pathname formats
linecache: random storage of lines of text
shutil: advanced file operations
macpath: MacOS 9 path control function
Endurance
pickle: Python object serialization
copyreg: The registration machine’s support function for pickle
shelve: Python object persistence
marshal: Internal Python object serialization
dbm: Unix "database" interface
sqlite3: API 2.0 for SQLite databases
compression
zlib: gzip-compatible compression
gzip: support for gzip files
bz2: support for bzip2 compression
lzma: Compression using the LZMA algorithm
zipfile: Manipulate ZIP archives
tarfile: read and write tar archive files
file formatting
csv: read and write CSV files
configparser: configuration file parser
netrc: netrc file processor
xdrlib: XDR data encoding and decoding
plistlib: Generate and parse Mac OS X .plist files
encryption
hashlib: secure hashing and message digests
hmac: key hashing for message authentication
operating system tools
os: multifaceted operating system interface
io: stream core tools
time: Query and conversion of time
argparser: Parser for command line options, arguments, and subcommands
optparser: command line option parser
getopt: C-style command line option parser
logging: Python logging tool
logging.config: log configuration
logging.handlers: log processor
getpass: simple password entry
curses: terminal processing of character display
curses.textpad: text input field for curses program
curses.ascii: ASCII character set tool
curses.panel: Control stack extension for curses
platform: access the underlying platform authentication data
errno: standard error notation
ctypes: Python external function library
concurrent
threading: thread-based parallelism
multiprocessing: process-based parallelism
concurrent: concurrent package
concurrent.futures: Start parallel tasks
subprocess: subprocess management
sched: event scheduling
queue: synchronization queue
select: wait for I/O to complete
dummy_threading: replacement for the threading module (when _thread is not available)
_thread: The underlying thread API (threading is based on it)
_dummy_thread: replacement for the _thread module (when _thread is not available)
interprocess communication
socket: underlying network interface
ssl: TLS/SSL shim for socket object
asyncore: asynchronous socket processor
asynchat: Asynchronous socket command/response handler
signal: asynchronous transaction signal processor
mmap: memory mapped file support
internet
mail: Mail and MIME processing package
json: JSON encoding and decoding
mailcap: mailcap file processing
mailbox: control mailboxes in multiple formats
mimetypes: file name and MIME type mapping
base64:RFC
3548: Base16, Base32, Base64 encoding
binhex: binhex4 file encoding and decoding
binascii: conversion between binary code and ASCII code
quopri:MIME
Quoted - encoding and decoding of printable data
uu: Encoding and decoding of uuencode files
HTML to XML
html: HTML support
html.parser: Simple HTML and XHTML parser
html.entities: Definition of HTML general entities
xml: XML processing module
xml.etree.ElementTree: Tree XML element API
xml.dom:XML DOM API
xml.dom.minidom: XML DOM minimum spanning tree
xml.dom.pulldom: support for building partial DOM trees
xml.sax: SAX2 parsing support
xml.sax.handler: SAX processor base class
xml.sax.saxutils: SAX tools
xml.sax.xmlreader: SAX parser interface
xml.parsers.expat: Use Expat to quickly parse XML
Internet protocols and support
webbrowser: Simple web browser controller
cgi: CGI support
cgitb: CGI script backtrace manager
wsgiref: WSGI tool and reference implementation
urllib: URL processing module
urllib.request: Extension library that opens URL connections
urllib.response: response class of urllib module
urllib.parse: Parse URLs into components
urllib.error: exception class raised by urllib.request
urllib.robotparser: parser for robots.txt
http: HTTP module
http.client: HTTP protocol client
ftplib: FTP protocol client
poplib: POP protocol client
imaplib: IMAP4 protocol client
nntplib: NNTP protocol client
smtplib: SMTP protocol client
smtpd: SMTP server
telnetlib: Telnet client
uuid: UUID object of RFC4122
socketserver: network server framework
http.server: HTTP server
http.cookies: HTTPCookie state manager
http.cookiejar: Cookie handling for HTTP clients
xmlrpc: XML - RPC server and client module
xmlrpc.client: XML - RPC client access
xmlrpc.server: XML - RPC server basics
ipaddress: IPv4/IPv6 control library
multimedia
audioop: Process raw audio data
aifc: read and write AIFF and AIFC files
sunau: read and write Sun AU files
wave: read and write WAV files
chunk: Read large IFF files
colorsys: Conversion between color systems
imghdr: Specify image type
sndhdr: Specify the sound file type
ossaudiodev: access OSS-compatible audio devices
globalization
gettext: multi-language internationalization service
locale: internationalization service
programming framework
turtle: Turtle graphics library
cmd: line-based command interpreter support
shlex: simple dictionary analysis
Tk graphical user interface
tkinter: Tcl/Tk interface
tkinter.ttk: Tk theme control
tkinter.tix: Tk extended control
tkinter.scrolledtext: scroll text control
development tools
pydoc: documentation generator and online help system
doctest: Interactive Python examples
unittest: unit testing framework
unittest.mock: Mock object library
test: Python regression testing package
test.support: Python testing tool suite
venv: virtual environment setup
debug
bdb: debugging framework
faulthandler: Python reverse tracing library
pdb: Python debugger
timeit: Measurement of execution time of small pieces of code
trace: Python execution status tracking
Runtime
sys: system-related parameters and functions
sysconfig: access Python configuration information
builtins: built-in objects
main: top-level script environment
warnings: warning control
contextlib: context tool with state
abc: virtual base class
atexit: export processor
traceback: print or read a reverse trace of the stack
future: future state definition
gc: garbage collection interface
inspect: inspect living objects
site: Address-related configuration hook (hook)
fpectl: floating point number exception control
distutils: Generate and install Python modules
interpreter
code: base class interpreter
codeop: compile Python code
Import module
imp: access the internals of the import module
zipimport: Import modules from ZIP archives
pkgutil: package extension tool
modulefinder: Find modules through scripts
runpy: locate and execute Python modules
importlib: an implementation of import
Python language
parser: access the Python parse tree
ast: abstract syntax tree
symtable: access the compiler symbol table
symbol: constant in Python parse tree
token: constant in Python parse tree
keyword: Python keyword test
tokenize: Python source file word segmentation
tabnany: Fuzzy indentation detection
pyclbr: Python class browsing support
py_compile: Compile Python source files
compileall: compile Python library by byte
dis: disassembler for Python bytecode
pickletools: serialization development tools
other
formatter: general formatted output
Windows related
msilib: Read and write Windows Installer files
msvcrt: Useful program for MS VC++ Runtime
winreg: Windows registry access
winsound: Windows sound playback interface
Unix related
posix: the most commonly used POSIX calls
pwd: password database
spwd: shadow password database
grp: group database
crypt: Unix password verification
termios: POSIX-style tty control
tty: terminal control function
pty: pseudo terminal tool
fcntl: system calls fcntl() and ioctl()
pipes: shell pipe interface
resource: resource available information
nis: Sun's NIS interface
syslog: Unix log service
For more exciting content, please search "Qianfeng Education" on Station B.