Python 模块索引
b |
c |
d |
e |
f |
g |
h |
i |
j |
k |
l |
m |
n |
o |
p |
q |
r |
s |
t |
u |
v |
w |
x |
[\_future__ ](text-part0311.html#98IUU5-d22b512385d642aa866e92d740b0e627) | Future statement definitions | |
__main__ | The environment where top-level code is run. Covers command-line
interfaces, import-time behavior, and __name__ == '__main__' .
| |
_thread | Low-level threading API. | |
_tkinter | A binary module that contains the low-level interface to Tcl/Tk. | |
a | ||
abc | Abstract base classes according to :pep:3119 . | |
aifc | 已弃用: Removed in 3.13. | |
argparse | Command-line option and argument parsing library. | |
array | Space efficient arrays of uniformly typed numeric values. | |
ast | Abstract Syntax Tree classes and manipulation. | |
asynchat | 已弃用: Removed in 3.12. | |
asyncio | Asynchronous I/O. | |
asyncore | 已弃用: Removed in 3.12. | |
atexit | Register and execute cleanup functions. | |
audioop | 已弃用: Removed in 3.13. | |
b | ||
base64 | RFC 4648: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85 | |
bdb | Debugger framework. | |
binascii | Tools for converting between binary and various ASCII-encoded binary representations. | |
bisect | Array bisection algorithms for binary searching. | |
builtins | The module that provides the builtin namespace. | |
bz2 | Interfaces for bzip2 compression and decompression. | |
c | ||
calendar | Functions for working with calendars, including some emulation of the Unix cal program. | |
cgi | 已弃用: Removed in 3.13. | |
cgitb | 已弃用: Removed in 3.13. | |
chunk | 已弃用: Removed in 3.13. | |
cmath | Mathematical functions for complex numbers. | |
cmd | Build line-oriented command interpreters. | |
code | Facilities to implement read-eval-print loops. | |
codecs | Encode and decode data and streams. | |
codeop | Compile (possibly incomplete) Python code. | |
![]() | collections | Container datatypes |
collections.abc
| Abstract base classes for containers | |
colorsys | Conversion functions between RGB and other color systems. | |
compileall | Tools for byte-compiling all Python source files in a directory tree. | |
![]() | concurrent | |
concurrent.futures
| Execute computations concurrently using threads or processes. | |
configparser | Configuration file parser. | |
contextlib | Utilities for with-statement contexts. | |
contextvars | Context Variables | |
copy | Shallow and deep copy operations. | |
copyreg | Register pickle support functions. | |
cProfile | ||
crypt | 已弃用: Removed in 3.13. | |
csv | Write and read tabular data to and from delimited files. | |
ctypes | A foreign function library for Python. | |
![]() | curses (Unix) | An interface to the curses library, providing portable terminal handling. |
curses.ascii
| Constants and set-membership functions for ASCII characters. | |
curses.panel
| A panel stack extension that adds depth to curses windows. | |
curses.textpad
| Emacs-like input editing in a curses window. | |
d | ||
dataclasses | Generate special methods on user-defined classes. | |
datetime | Basic date and time types. | |
![]() | dbm | Interfaces to various Unix "database" formats. |
dbm.dumb
| Portable implementation of the simple DBM interface. | |
dbm.gnu (Unix)
| GNU database manager | |
dbm.ndbm (Unix)
| The New Database Manager | |
dbm.sqlite3 (All)
| SQLite backend for dbm | |
decimal | Implementation of the General Decimal Arithmetic Specification. | |
difflib | Helpers for computing differences between objects. | |
dis | Disassembler for Python bytecode. | |
distutils | 已弃用: Removed in 3.12. | |
doctest | Test pieces of code within docstrings. | |
e | ||
![]() | email | Package supporting the parsing, manipulating, and generating email messages. |
email.charset
| Character Sets | |
email.contentmanager
| Storing and Retrieving Content from MIME Parts | |
email.encoders
| Encoders for email message payloads. | |
email.errors
| The exception classes used by the email package. | |
email.generator
| Generate flat text email messages from a message structure. | |
email.header
| Representing non-ASCII headers | |
email.headerregistry
| Automatic Parsing of headers based on the field name | |
email.iterators
| Iterate over a message object tree. | |
email.message
| The base class representing email messages. | |
email.mime
| Build MIME messages. | |
email.mime.application
| ||
email.mime.audio
| ||
email.mime.base
| ||
email.mime.image
| ||
email.mime.message
| ||
email.mime.multipart
| ||
email.mime.nonmultipart
| ||
email.mime.text
| ||
email.parser
| Parse flat text email messages to produce a message object structure. | |
email.policy
| Controlling the parsing and generating of messages | |
email.utils
| Miscellaneous email package utilities. | |
![]() | encodings | |
encodings.idna
| Internationalized Domain Names implementation | |
encodings.mbcs
| Windows ANSI codepage | |
encodings.utf_8_sig
| UTF-8 codec with BOM signature | |
ensurepip | Bootstrapping the "pip" installer into an existing Python installation or virtual environment. | |
enum | Implementation of an enumeration class. | |
errno | Standard errno system symbols. | |
f | ||
faulthandler | Dump the Python traceback. | |
fcntl (Unix) | The fcntl() and ioctl() system calls. | |
filecmp | Compare files efficiently. | |
fileinput | Loop over standard input or a list of files. | |
fnmatch | Unix shell style filename pattern matching. | |
fractions | Rational numbers. | |
ftplib | FTP protocol client (requires sockets). | |
functools | Higher-order functions and operations on callable objects. | |
g | ||
gc | Interface to the cycle-detecting garbage collector. | |
getopt | Portable parser for command line options; support both short and long option names. | |
getpass | Portable reading of passwords and retrieval of the userid. | |
gettext | Multilingual internationalization services. | |
glob | Unix shell style pathname pattern expansion. | |
graphlib | Functionality to operate with graph-like structures | |
grp (Unix) | The group database (getgrnam() and friends). | |
gzip | Interfaces for gzip compression and decompression using file objects. | |
h | ||
hashlib | Secure hash and message digest algorithms. | |
heapq | Heap queue algorithm (a.k.a. priority queue). | |
hmac | Keyed-Hashing for Message Authentication (HMAC) implementation | |
![]() | html | Helpers for manipulating HTML. |
html.entities
| Definitions of HTML general entities. | |
html.parser
| A simple parser that can handle HTML and XHTML. | |
![]() | http | HTTP status codes and messages |
http.client
| HTTP and HTTPS protocol client (requires sockets). | |
http.cookiejar
| Classes for automatic handling of HTTP cookies. | |
http.cookies
| Support for HTTP state management (cookies). | |
http.server
| HTTP server and request handlers. | |
i | ||
idlelib | Implementation package for the IDLE shell/editor. | |
imaplib | IMAP4 protocol client (requires sockets). | |
imghdr | 已弃用: Removed in 3.13. | |
imp | 已弃用: Removed in 3.12. | |
![]() | importlib | The implementation of the import machinery. |
importlib.abc
| Abstract base classes related to import | |
importlib.machinery
| Importers and path hooks | |
importlib.metadata
| Accessing package metadata | |
importlib.resources
| Package resource reading, opening, and access | |
importlib.resources.abc
| Abstract base classes for resources | |
importlib.util
| Utility code for importers | |
inspect | Extract information and source code from live objects. | |
io | Core tools for working with streams. | |
ipaddress | IPv4/IPv6 manipulation library. | |
itertools | Functions creating iterators for efficient looping. | |
j | ||
![]() | json | Encode and decode the JSON format. |
json.tool
| A command line to validate and pretty-print JSON. | |
k | ||
keyword | Test whether a string is a keyword in Python. | |
l | ||
linecache | Provides random access to individual lines from text files. | |
locale | Internationalization services. | |
![]() | logging | Flexible event logging system for applications. |
logging.config
| Configuration of the logging module. | |
logging.handlers
| Handlers for the logging module. | |
lzma | A Python wrapper for the liblzma compression library. | |
m | ||
mailbox | Manipulate mailboxes in various formats | |
mailcap | 已弃用: Removed in 3.13. | |
marshal | Convert Python objects to streams of bytes and back (with different constraints). | |
math | Mathematical functions (sin() etc.). | |
mimetypes | Mapping of filename extensions to MIME types. | |
mmap | Interface to memory-mapped files for Unix and Windows. | |
modulefinder | Find modules used by a script. | |
msilib | 已弃用: Removed in 3.13. | |
msvcrt (Windows) | Miscellaneous useful routines from the MS VC++ runtime. | |
![]() | multiprocessing | Process-based parallelism. |
multiprocessing.connection
| API for dealing with sockets. | |
multiprocessing.dummy
| Dumb wrapper around threading. | |
multiprocessing.managers
| Share data between process with shared objects. | |
multiprocessing.pool
| Create pools of processes. | |
multiprocessing.shared_memory
| Provides shared memory for direct access across processes. | |
multiprocessing.sharedctypes
| Allocate ctypes objects from shared memory. | |
n | ||
netrc | Loading of .netrc files. | |
nis | 已弃用: Removed in 3.13. | |
nntplib | 已弃用: Removed in 3.13. | |
numbers | Numeric abstract base classes (Complex, Real, Integral, etc.). | |
o | ||
operator | Functions corresponding to the standard operators. | |
optparse | Command-line option parsing library. | |
![]() | os | Miscellaneous operating system interfaces. |
os.path
| Operations on pathnames. | |
ossaudiodev | 已弃用: Removed in 3.13. | |
p | ||
pathlib | Object-oriented filesystem paths | |
pdb | The Python debugger for interactive interpreters. | |
pickle | Convert Python objects to streams of bytes and back. | |
pickletools | Contains extensive comments about the pickle protocols and pickle-machine opcodes, as well as some useful functions. | |
pipes | 已弃用: Removed in 3.13. | |
pkgutil | Utilities for the import system. | |
platform | Retrieves as much platform identifying data as possible. | |
plistlib | Generate and parse Apple plist files. | |
poplib | POP3 protocol client (requires sockets). | |
posix (Unix) | The most common POSIX system calls (normally used via module os). | |
pprint | Data pretty printer. | |
profile | Python source profiler. | |
pstats | Statistics object for use with the profiler. | |
pty (Unix) | Pseudo-Terminal Handling for Unix. | |
pwd (Unix) | The password database (getpwnam() and friends). | |
py_compile | Generate bytecode files from Python source files. | |
pyclbr | Supports information extraction for a Python module browser. | |
pydoc | Documentation generator and online help system. | |
q | ||
queue | A synchronized queue class. | |
quopri | Encode and decode files using the MIME quoted-printable encoding. | |
r | ||
random | Generate pseudo-random numbers with various common distributions. | |
re | Regular expression operations. | |
readline (Unix) | GNU readline support for Python. | |
reprlib | Alternate repr() implementation with size limits. | |
resource (Unix) | An interface to provide resource usage information on the current process. | |
rlcompleter | Python identifier completion, suitable for the GNU readline library. | |
runpy | Locate and run Python modules without importing them first. | |
s | ||
sched | General purpose event scheduler. | |
secrets | Generate secure random numbers for managing secrets. | |
select | Wait for I/O completion on multiple streams. | |
selectors | High-level I/O multiplexing. | |
shelve | Python object persistence. | |
shlex | Simple lexical analysis for Unix shell-like languages. | |
shutil | High-level file operations, including copying. | |
signal | Set handlers for asynchronous events. | |
site | Module responsible for site-specific configuration. | |
sitecustomize | ||
smtpd | 已弃用: Removed in 3.12. | |
smtplib | SMTP protocol client (requires sockets). | |
sndhdr | 已弃用: Removed in 3.13. | |
socket | Low-level networking interface. | |
socketserver | A framework for network servers. | |
spwd | 已弃用: Removed in 3.13. | |
sqlite3 | A DB-API 2.0 implementation using SQLite 3.x. | |
ssl | TLS/SSL wrapper for socket objects | |
stat | Utilities for interpreting the results of os.stat(), os.lstat() and os.fstat(). | |
statistics | Mathematical statistics functions | |
string | Common string operations. | |
stringprep | String preparation, as per RFC 3453 | |
struct | Interpret bytes as packed binary data. | |
subprocess | Subprocess management. | |
sunau | 已弃用: Removed in 3.13. | |
symtable | Interface to the compiler's internal symbol tables. | |
![]() | sys | Access system-specific parameters and functions. |
sys.monitoring
| Access and control event monitoring | |
sysconfig | Python's configuration information | |
syslog (Unix) | An interface to the Unix syslog library routines. | |
t | ||
tabnanny | Tool for detecting white space related problems in Python source files in a directory tree. | |
tarfile | Read and write tar-format archive files. | |
telnetlib | 已弃用: Removed in 3.13. | |
tempfile | Generate temporary files and directories. | |
termios (Unix) | POSIX style tty control. | |
![]() | test | Regression tests package containing the testing suite for Python. |
test.regrtest
| Drives the regression test suite. | |
test.support
| Support for Python's regression test suite. | |
test.support.bytecode_helper
| Support tools for testing correct bytecode generation. | |
test.support.import_helper
| Support for import tests. | |
test.support.os_helper
| Support for os tests. | |
test.support.script_helper
| Support for Python's script execution tests. | |
test.support.socket_helper
| Support for socket tests. | |
test.support.threading_helper
| Support for threading tests. | |
test.support.warnings_helper
| Support for warnings tests. | |
textwrap | Text wrapping and filling | |
threading | Thread-based parallelism. | |
time | Time access and conversions. | |
timeit | Measure the execution time of small code snippets. | |
![]() | tkinter | Interface to Tcl/Tk for graphical user interfaces |
tkinter.colorchooser (Tk)
| Color choosing dialog | |
tkinter.commondialog (Tk)
| Tkinter base class for dialogs | |
tkinter.dnd (Tk)
| Tkinter drag-and-drop interface | |
tkinter.filedialog (Tk)
| Dialog classes for file selection | |
tkinter.font (Tk)
| Tkinter font-wrapping class | |
tkinter.messagebox (Tk)
| Various types of alert dialogs | |
tkinter.scrolledtext (Tk)
| Text widget with a vertical scroll bar. | |
tkinter.simpledialog (Tk)
| Simple dialog windows | |
tkinter.ttk
| Tk themed widget set | |
token | Constants representing terminal nodes of the parse tree. | |
tokenize | Lexical scanner for Python source code. | |
tomllib | Parse TOML files. | |
trace | Trace or track Python statement execution. | |
traceback | Print or retrieve a stack traceback. | |
tracemalloc | Trace memory allocations. | |
tty (Unix) | Utility functions that perform common terminal control operations. | |
turtle | An educational framework for simple graphics applications | |
turtledemo | A viewer for example turtle scripts | |
types | Names for builtin types. | |
typing | Support for type hints (see :pep:484 ). | |
u | ||
unicodedata | Access the Unicode Database. | |
![]() | unittest | Unit testing framework for Python. |
unittest.mock
| Mock object library. | |
![]() | urllib | |
urllib.error
| Exception classes raised by urllib.request. | |
urllib.parse
| Parse URLs into or assemble them from components. | |
urllib.request
| Extensible library for opening URLs. | |
urllib.response
| Response classes used by urllib. | |
urllib.robotparser
| Load a robots.txt file and answer questions about fetchability of other URLs. | |
usercustomize | ||
uu | 已弃用: Removed in 3.13. | |
uuid | UUID objects (universally unique identifiers) according to RFC 4122 | |
v | ||
venv | Creation of virtual environments. | |
w | ||
warnings | Issue warning messages and control their disposition. | |
wave | Provide an interface to the WAV sound format. | |
weakref | Support for weak references and weak dictionaries. | |
webbrowser | Easy-to-use controller for web browsers. | |
winreg (Windows) | Routines and objects for manipulating the Windows registry. | |
winsound (Windows) | Access to the sound-playing machinery for Windows. | |
![]() | wsgiref | WSGI Utilities and Reference Implementation. |
wsgiref.handlers
| WSGI server/gateway base classes. | |
wsgiref.headers
| WSGI response header tools. | |
wsgiref.simple_server
| A simple WSGI HTTP server. | |
wsgiref.types
| WSGI types for static type checking | |
wsgiref.util
| WSGI environment utilities. | |
wsgiref.validate
| WSGI conformance checker. | |
x | ||
xdrlib | 已弃用: Removed in 3.13. | |
![]() | xml | Package containing XML processing modules |
xml.dom
| Document Object Model API for Python. | |
xml.dom.minidom
| Minimal Document Object Model (DOM) implementation. | |
xml.dom.pulldom
| Support for building partial DOM trees from SAX events. | |
xml.etree.ElementInclude
| ||
xml.etree.ElementTree
| Implementation of the ElementTree API. | |
xml.parsers.expat
| An interface to the Expat non-validating XML parser. | |
xml.parsers.expat.errors
| ||
xml.parsers.expat.model
| ||
xml.sax
| Package containing SAX2 base classes and convenience functions. | |
xml.sax.handler
| Base classes for SAX event handlers. | |
xml.sax.saxutils
| Convenience functions and classes for use with SAX. | |
xml.sax.xmlreader
| Interface which SAX-compliant XML parsers must implement. | |
![]() | xmlrpc | Server and client modules implementing XML-RPC. |
xmlrpc.client
| XML-RPC client access. | |
xmlrpc.server
| Basic XML-RPC server implementations. | |
z | ||
zipapp | Manage executable Python zip archives | |
zipfile | Read and write ZIP-format archive files. | |
zipimport | Support for importing Python modules from ZIP archives. | |
zlib | Low-level interface to compression and decompression routines compatible with gzip. | |
zoneinfo | IANA time zone support |