python_standard_library

Python Standard Library

Return to Python 3 Standard Library by Example, Standard libraries, Python, Python Articles, Python Glossary, Awesome Python

“While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the optional Python components that are commonly included in Python distributions.”

Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table of contents listed below. The library contains built-in Python modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming. Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform-neutral Python APIs.”

“The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. For Unix-like operating systems Python is normally provided as a collection of packages, so it may be necessary to use the packaging tools provided with the operating system to obtain some or all of the optional components.”

In addition to the standard library, there is a growing collection of several thousand Python components (from individual programs and modules to packages and entire Python application development frameworks), available from the Python Package Index.“

Built-in Types

Built-in Exceptions

Text Processing Services

Binary Data Services

Data Types

Numeric and Mathematical Modules

Functional Programming Modules

itertools — Functions creating iterators for efficient looping functools — Higher-order functions and operations on callable objects operator — Standard operators as functions

File and Directory Access

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

Data Persistence

pickle — Python object serialization copyreg — Register pickle support functions shelve — Python object persistence marshal — Internal Python object serialization dbm — Interfaces to Unix “databases” sqlite3 — DB-API 2.0 interface for SQLite databases Data Compression and Archiving zlib — Compression compatible with gzip gzip — Support for gzip files bz2 — Support for bzip2 compression lzma — Compression using the LZMA algorithm zipfile — Work with ZIP archives tarfile — Read and write tar archive files File Formats csv — CSV File Reading and Writing configparser — Configuration file parser netrc — netrc file processing plistlib — Generate and parse Apple .plist files

Cryptographic Services

hashlib — Secure hashes and message digests hmac — Keyed-Hashing for Message Authentication secrets — Generate secure random numbers for managing secrets Generic Operating System Services 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 curses — Terminal handling for character-cell displays curses.textpad — Text input widget for curses programs curses.ascii — Utilities for ASCII characters curses.panel — A panel stack extension for curses platform — Access to underlying platform’s identifying data errno — Standard errno system symbols ctypes — A foreign function library for Python

Concurrent Execution

threading — Thread-based parallelism multiprocessing — Process-based parallelism multiprocessing.shared_memory — Provides shared memory for direct access across processes The 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

Networking and Interprocess Communication

socket — Low-level networking interface ssl — TLS/SSL wrapper for socket objects select — Waiting for I/O completion selectors — High-level I/O multiplexing signal — Set handlers for asynchronous events mmap — Memory-mapped file support Internet Data Handling email — An email and MIME handling package 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

Structured Markup Processing Tools

html — HyperText Markup Language support html.parser — Simple HTML and XHTML parser html.entities — Definitions of HTML general entities

XML Processing Modules

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

Internet Protocols and Support

webbrowser — Convenient web-browser controller wsgiref — WSGI Utilities and Reference Implementation urllib — URL handling modules urllib.request — Extensible library for opening URLs urllib.response — Response classes used by urllib 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

Multimedia Services

wave — Read and write WAV files colorsys — Conversions between color systems

Internationalization

gettext — Multilingual internationalization services locale — Internationalization services

Program Frameworks

turtle — Turtle graphics cmd — Support for line-oriented command interpreters shlex — Simple lexical analysis Graphical User Interfaces with Tk tkinter — Python interface to Tcl/Tk tkinter.colorchooser — Color choosing dialog tkinter.font — Tkinter font wrapper Tkinter Dialogs tkinter.messagebox — Tkinter message prompts tkinter.scrolledtext — Scrolled Text Widget tkinter.dnd — Drag and drop support tkinter.ttk — Tk themed widgets tkinter.tix — Extension widgets for Tk

IDLE

Development Tools

typing — Support for type hints pydoc — Documentation generator and online help system Python Development Mode Effects of the Python Development Mode ResourceWarning Example Bad file descriptor error example doctest — Test interactive Python examples unittest — Unit testing framework unittest.mock — mock object library unittest.mock — getting started 2to3 - Automated Python 2 to 3 code translation test — Regression tests package for Python test.support — Utilities for the Python test suite test.support.socket_helper — Utilities for socket tests test.support.script_helper — Utilities for the Python execution tests test.support.bytecode_helper — Support tools for testing correct bytecode generation test.support.threading_helper — Utilities for threading tests test.support.os_helper — Utilities for os tests test.support.import_helper — Utilities for import tests test.support.warnings_helper — Utilities for warnings tests

Debugging and Profiling

Audit events table bdb — Debugger framework faulthandler — Dump the Python traceback pdb — The Python Debugger The Python Profilers timeit — Measure execution time of small code snippets trace — Trace or track Python statement execution tracemalloc — Trace memory allocations Software Packaging and Distribution distutils — Building and installing Python modules ensurepip — Bootstrapping the pip installer venv — Creation of virtual environments zipapp — Manage executable Python zip archives

Python Runtime Services

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 Custom Python Interpreters code — Interpreter base classes codeop — Compile Python code Importing Modules zipimport — Import modules from Zip archives pkgutil — Package extension utility modulefinder — Find modules used by a script runpy — Locating and executing Python modules importlib — The implementation of import Using importlib.metadata

Python Language Services

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

MS Windows Specific Services

msvcrt — Useful routines from the MS VC++ runtime winreg — Windows registry access winsound — Sound-playing interface for Windows Unix Specific Services 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 Superseded Modules 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 Undocumented Modules Platform specific modules

Security Considerations

© Copyright 2001-2022, Python Software Foundation.

This page is licensed under the Python Software Foundation License Version 2.

Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.

See Python History and Python License for more information.

The Python Software Foundation is a non-profit corporation.

Last updated on Mar 27, 2022.

Created using Sphinx 3.2.1.

Fair Use Source: https://docs.python.org/3/library

Python: Python Variables, Python Data Types, Python Control Structures, Python Loops, Python Functions, Python Modules, Python Packages, Python File Handling, Python Errors and Exceptions, Python Classes and Objects, Python Inheritance, Python Polymorphism, Python Encapsulation, Python Abstraction, Python Lists, Python Dictionaries, Python Tuples, Python Sets, Python String Manipulation, Python Regular Expressions, Python Comprehensions, Python Lambda Functions, Python Map, Filter, and Reduce, Python Decorators, Python Generators, Python Context Managers, Python Concurrency with Threads, Python Asynchronous Programming, Python Multiprocessing, Python Networking, Python Database Interaction, Python Debugging, Python Testing and Unit Testing, Python Virtual Environments, Python Package Management, Python Data Analysis, Python Data Visualization, Python Web Scraping, Python Web Development with Flask/Django, Python API Interaction, Python GUI Programming, Python Game Development, Python Security and Cryptography, Python Blockchain Programming, Python Machine Learning, Python Deep Learning, Python Natural Language Processing, Python Computer Vision, Python Robotics, Python Scientific Computing, Python Data Engineering, Python Cloud Computing, Python DevOps Tools, Python Performance Optimization, Python Design Patterns, Python Type Hints, Python Version Control with Git, Python Documentation, Python Internationalization and Localization, Python Accessibility, Python Configurations and Environments, Python Continuous Integration/Continuous Deployment, Python Algorithm Design, Python Problem Solving, Python Code Readability, Python Software Architecture, Python Refactoring, Python Integration with Other Languages, Python Microservices Architecture, Python Serverless Computing, Python Big Data Analysis, Python Internet of Things (IoT), Python Geospatial Analysis, Python Quantum Computing, Python Bioinformatics, Python Ethical Hacking, Python Artificial Intelligence, Python Augmented Reality and Virtual Reality, Python Blockchain Applications, Python Chatbots, Python Voice Assistants, Python Edge Computing, Python Graph Algorithms, Python Social Network Analysis, Python Time Series Analysis, Python Image Processing, Python Audio Processing, Python Video Processing, Python 3D Programming, Python Parallel Computing, Python Event-Driven Programming, Python Reactive Programming.

Variables, Data Types, Control Structures, Loops, Functions, Modules, Packages, File Handling, Errors and Exceptions, Classes and Objects, Inheritance, Polymorphism, Encapsulation, Abstraction, Lists, Dictionaries, Tuples, Sets, String Manipulation, Regular Expressions, Comprehensions, Lambda Functions, Map, Filter, and Reduce, Decorators, Generators, Context Managers, Concurrency with Threads, Asynchronous Programming, Multiprocessing, Networking, Database Interaction, Debugging, Testing and Unit Testing, Virtual Environments, Package Management, Data Analysis, Data Visualization, Web Scraping, Web Development with Flask/Django, API Interaction, GUI Programming, Game Development, Security and Cryptography, Blockchain Programming, Machine Learning, Deep Learning, Natural Language Processing, Computer Vision, Robotics, Scientific Computing, Data Engineering, Cloud Computing, DevOps Tools, Performance Optimization, Design Patterns, Type Hints, Version Control with Git, Documentation, Internationalization and Localization, Accessibility, Configurations and Environments, Continuous Integration/Continuous Deployment, Algorithm Design, Problem Solving, Code Readability, Software Architecture, Refactoring, Integration with Other Languages, Microservices Architecture, Serverless Computing, Big Data Analysis, Internet of Things (IoT), Geospatial Analysis, Quantum Computing, Bioinformatics, Ethical Hacking, Artificial Intelligence, Augmented Reality and Virtual Reality, Blockchain Applications, Chatbots, Voice Assistants, Edge Computing, Graph Algorithms, Social Network Analysis, Time Series Analysis, Image Processing, Audio Processing, Video Processing, 3D Programming, Parallel Computing, Event-Driven Programming, Reactive Programming.


Python Glossary, Python Fundamentals, Python Inventor: Python Language Designer: Guido van Rossum on 20 February 1991; PEPs, Python Scripting, Python Keywords, Python Built-In Data Types, Python Data Structures - Python Algorithms, Python Syntax, Python OOP - Python Design Patterns, Python Module Index, pymotw.com, Python Package Manager (pip-PyPI), Python Virtualization (Conda, Miniconda, Virtualenv, Pipenv, Poetry), Python Interpreter, CPython, Python REPL, Python IDEs (PyCharm, Jupyter Notebook), Python Development Tools, Python Linter, Pythonista-Python User, Python Uses, List of Python Software, Python Popularity, Python Compiler, Python Transpiler, Python DevOps - Python SRE, Python Data Science - Python DataOps, Python Machine Learning, Python Deep Learning, Functional Python, Python Concurrency - Python GIL - Python Async (Asyncio), Python Standard Library, Python Testing (Pytest), Python Libraries (Flask), Python Frameworks (Django), Python History, Python Bibliography, Manning Python Series, Python Official Glossary - Python Glossary, Python Topics, Python Courses, Python Research, Python GitHub, Written in Python, Python Awesome List, Python Versions. (navbar_python - see also navbar_python_libaries, navbar_python_standard_library, navbar_python_virtual_environments, navbar_numpy, navbar_datascience)


© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


python_standard_library.txt · Last modified: 2024/04/28 03:42 by 127.0.0.1