here2share

Python Standard Library

Oct 5th, 2019
783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 15.73 KB | None | 0 0
  1. The Python Standard Library
  2.  
  3. '''
  4. 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 components that are commonly included in Python distributions.
  5.  
  6. 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 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 APIs.
  7.  
  8. 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.
  9.  
  10. In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from the Python Package Index.
  11.  
  12.    Introduction
  13.        Notes on availability
  14.    Built-in Functions
  15.    Built-in Constants
  16.        Constants added by the site module
  17.    Built-in Types
  18.        Truth Value Testing
  19.        Boolean Operations — and, or, not
  20.        Comparisons
  21.        Numeric Types — int, float, complex
  22.        Iterator Types
  23.        Sequence Types — list, tuple, range
  24.        Text Sequence Type — str
  25.        Binary Sequence Types — bytes, bytearray, memoryview
  26.        Set Types — set, frozenset
  27.        Mapping Types — dict
  28.        Context Manager Types
  29.        Other Built-in Types
  30.        Special Attributes
  31.    Built-in Exceptions
  32.        Base classes
  33.        Concrete exceptions
  34.        Warnings
  35.        Exception hierarchy
  36.    Text Processing Services
  37.        string — Common string operations
  38.        re — Regular expression operations
  39.        difflib — Helpers for computing deltas
  40.        textwrap — Text wrapping and filling
  41.        unicodedata — Unicode Database
  42.        stringprep — Internet String Preparation
  43.        readline — GNU readline interface
  44.        rlcompleter — Completion function for GNU readline
  45.    Binary Data Services
  46.        struct — Interpret bytes as packed binary data
  47.        codecs — Codec registry and base classes
  48.    Data Types
  49.        datetime — Basic date and time types
  50.        calendar — General calendar-related functions
  51.        collections — Container datatypes
  52.        collections.abc — Abstract Base Classes for Containers
  53.        heapq — Heap queue algorithm
  54.        bisect — Array bisection algorithm
  55.        array — Efficient arrays of numeric values
  56.        weakref — Weak references
  57.        types — Dynamic type creation and names for built-in types
  58.        copy — Shallow and deep copy operations
  59.        pprint — Data pretty printer
  60.        reprlib — Alternate repr() implementation
  61.        enum — Support for enumerations
  62.    Numeric and Mathematical Modules
  63.        numbers — Numeric abstract base classes
  64.        math — Mathematical functions
  65.        cmath — Mathematical functions for complex numbers
  66.        decimal — Decimal fixed point and floating point arithmetic
  67.        fractions — Rational numbers
  68.        random — Generate pseudo-random numbers
  69.        statistics — Mathematical statistics functions
  70.    Functional Programming Modules
  71.        itertools — Functions creating iterators for efficient looping
  72.        functools — Higher-order functions and operations on callable objects
  73.        operator — Standard operators as functions
  74.    File and Directory Access
  75.        pathlib — Object-oriented filesystem paths
  76.        os.path — Common pathname manipulations
  77.        fileinput — Iterate over lines from multiple input streams
  78.        stat — Interpreting stat() results
  79.        filecmp — File and Directory Comparisons
  80.        tempfile — Generate temporary files and directories
  81.        glob — Unix style pathname pattern expansion
  82.        fnmatch — Unix filename pattern matching
  83.        linecache — Random access to text lines
  84.        shutil — High-level file operations
  85.        macpath — Mac OS 9 path manipulation functions
  86.    Data Persistence
  87.        pickle — Python object serialization
  88.        copyreg — Register pickle support functions
  89.        shelve — Python object persistence
  90.        marshal — Internal Python object serialization
  91.        dbm — Interfaces to Unix “databases”
  92.        sqlite3 — DB-API 2.0 interface for SQLite databases
  93.    Data Compression and Archiving
  94.        zlib — Compression compatible with gzip
  95.        gzip — Support for gzip files
  96.        bz2 — Support for bzip2 compression
  97.        lzma — Compression using the LZMA algorithm
  98.        zipfile — Work with ZIP archives
  99.        tarfile — Read and write tar archive files
  100.    File Formats
  101.        csv — CSV File Reading and Writing
  102.        configparser — Configuration file parser
  103.        netrc — netrc file processing
  104.        xdrlib — Encode and decode XDR data
  105.        plistlib — Generate and parse Mac OS X .plist files
  106.    Cryptographic Services
  107.        hashlib — Secure hashes and message digests
  108.        hmac — Keyed-Hashing for Message Authentication
  109.        secrets — Generate secure random numbers for managing secrets
  110.    Generic Operating System Services
  111.        os — Miscellaneous operating system interfaces
  112.        io — Core tools for working with streams
  113.        time — Time access and conversions
  114.        argparse — Parser for command-line options, arguments and sub-commands
  115.        getopt — C-style parser for command line options
  116.        logging — Logging facility for Python
  117.        logging.config — Logging configuration
  118.        logging.handlers — Logging handlers
  119.        getpass — Portable password input
  120.        curses — Terminal handling for character-cell displays
  121.        curses.textpad — Text input widget for curses programs
  122.        curses.ascii — Utilities for ASCII characters
  123.        curses.panel — A panel stack extension for curses
  124.        platform — Access to underlying platform’s identifying data
  125.        errno — Standard errno system symbols
  126.        ctypes — A foreign function library for Python
  127.    Concurrent Execution
  128.        threading — Thread-based parallelism
  129.        multiprocessing — Process-based parallelism
  130.        The concurrent package
  131.        concurrent.futures — Launching parallel tasks
  132.        subprocess — Subprocess management
  133.        sched — Event scheduler
  134.        queue — A synchronized queue class
  135.        _thread — Low-level threading API
  136.        _dummy_thread — Drop-in replacement for the _thread module
  137.        dummy_threading — Drop-in replacement for the threading module
  138.    contextvars — Context Variables
  139.        Context Variables
  140.        Manual Context Management
  141.        asyncio support
  142.    Networking and Interprocess Communication
  143.        asyncio — Asynchronous I/O
  144.        socket — Low-level networking interface
  145.        ssl — TLS/SSL wrapper for socket objects
  146.        select — Waiting for I/O completion
  147.        selectors — High-level I/O multiplexing
  148.        asyncore — Asynchronous socket handler
  149.        asynchat — Asynchronous socket command/response handler
  150.        signal — Set handlers for asynchronous events
  151.        mmap — Memory-mapped file support
  152.    Internet Data Handling
  153.        email — An email and MIME handling package
  154.        json — JSON encoder and decoder
  155.        mailcap — Mailcap file handling
  156.        mailbox — Manipulate mailboxes in various formats
  157.        mimetypes — Map filenames to MIME types
  158.        base64 — Base16, Base32, Base64, Base85 Data Encodings
  159.        binhex — Encode and decode binhex4 files
  160.        binascii — Convert between binary and ASCII
  161.        quopri — Encode and decode MIME quoted-printable data
  162.        uu — Encode and decode uuencode files
  163.    Structured Markup Processing Tools
  164.        html — HyperText Markup Language support
  165.        html.parser — Simple HTML and XHTML parser
  166.        html.entities — Definitions of HTML general entities
  167.        XML Processing Modules
  168.        xml.etree.ElementTree — The ElementTree XML API
  169.        xml.dom — The Document Object Model API
  170.        xml.dom.minidom — Minimal DOM implementation
  171.        xml.dom.pulldom — Support for building partial DOM trees
  172.        xml.sax — Support for SAX2 parsers
  173.        xml.sax.handler — Base classes for SAX handlers
  174.        xml.sax.saxutils — SAX Utilities
  175.        xml.sax.xmlreader — Interface for XML parsers
  176.        xml.parsers.expat — Fast XML parsing using Expat
  177.    Internet Protocols and Support
  178.        webbrowser — Convenient Web-browser controller
  179.        cgi — Common Gateway Interface support
  180.        cgitb — Traceback manager for CGI scripts
  181.        wsgiref — WSGI Utilities and Reference Implementation
  182.        urllib — URL handling modules
  183.        urllib.request — Extensible library for opening URLs
  184.        urllib.response — Response classes used by urllib
  185.        urllib.parse — Parse URLs into components
  186.        urllib.error — Exception classes raised by urllib.request
  187.        urllib.robotparser — Parser for robots.txt
  188.        http — HTTP modules
  189.        http.client — HTTP protocol client
  190.        ftplib — FTP protocol client
  191.        poplib — POP3 protocol client
  192.        imaplib — IMAP4 protocol client
  193.        nntplib — NNTP protocol client
  194.        smtplib — SMTP protocol client
  195.        smtpd — SMTP Server
  196.        telnetlib — Telnet client
  197.        uuid — UUID objects according to RFC 4122
  198.        socketserver — A framework for network servers
  199.        http.server — HTTP servers
  200.        http.cookies — HTTP state management
  201.        http.cookiejar — Cookie handling for HTTP clients
  202.        xmlrpc — XMLRPC server and client modules
  203.        xmlrpc.client — XML-RPC client access
  204.        xmlrpc.server — Basic XML-RPC servers
  205.        ipaddress — IPv4/IPv6 manipulation library
  206.    Multimedia Services
  207.        audioop — Manipulate raw audio data
  208.        aifc — Read and write AIFF and AIFC files
  209.        sunau — Read and write Sun AU files
  210.        wave — Read and write WAV files
  211.        chunk — Read IFF chunked data
  212.        colorsys — Conversions between color systems
  213.        imghdr — Determine the type of an image
  214.        sndhdr — Determine type of sound file
  215.        ossaudiodev — Access to OSS-compatible audio devices
  216.    Internationalization
  217.        gettext — Multilingual internationalization services
  218.        locale — Internationalization services
  219.    Program Frameworks
  220.        turtle — Turtle graphics
  221.        cmd — Support for line-oriented command interpreters
  222.        shlex — Simple lexical analysis
  223.    Graphical User Interfaces with Tk
  224.        tkinter — Python interface to Tcl/Tk
  225.        tkinter.ttk — Tk themed widgets
  226.        tkinter.tix — Extension widgets for Tk
  227.        tkinter.scrolledtext — Scrolled Text Widget
  228.        IDLE
  229.        Other Graphical User Interface Packages
  230.    Development Tools
  231.        typing — Support for type hints
  232.        pydoc — Documentation generator and online help system
  233.        doctest — Test interactive Python examples
  234.        unittest — Unit testing framework
  235.        unittest.mock — mock object library
  236.        unittest.mock — getting started
  237.        2to3 - Automated Python 2 to 3 code translation
  238.        test — Regression tests package for Python
  239.        test.support — Utilities for the Python test suite
  240.        test.support.script_helper — Utilities for the Python execution tests
  241.    Debugging and Profiling
  242.        bdb — Debugger framework
  243.        faulthandler — Dump the Python traceback
  244.        pdb — The Python Debugger
  245.        The Python Profilers
  246.        timeit — Measure execution time of small code snippets
  247.        trace — Trace or track Python statement execution
  248.        tracemalloc — Trace memory allocations
  249.    Software Packaging and Distribution
  250.        distutils — Building and installing Python modules
  251.        ensurepip — Bootstrapping the pip installer
  252.        venv — Creation of virtual environments
  253.        zipapp — Manage executable Python zip archives
  254.    Python Runtime Services
  255.        sys — System-specific parameters and functions
  256.        sysconfig — Provide access to Python’s configuration information
  257.        builtins — Built-in objects
  258.        __main__ — Top-level script environment
  259.        warnings — Warning control
  260.        dataclasses — Data Classes
  261.        contextlib — Utilities for with-statement contexts
  262.        abc — Abstract Base Classes
  263.        atexit — Exit handlers
  264.        traceback — Print or retrieve a stack traceback
  265.        __future__ — Future statement definitions
  266.        gc — Garbage Collector interface
  267.        inspect — Inspect live objects
  268.        site — Site-specific configuration hook
  269.    Custom Python Interpreters
  270.        code — Interpreter base classes
  271.        codeop — Compile Python code
  272.    Importing Modules
  273.        zipimport — Import modules from Zip archives
  274.        pkgutil — Package extension utility
  275.        modulefinder — Find modules used by a script
  276.        runpy — Locating and executing Python modules
  277.        importlib — The implementation of import
  278.    Python Language Services
  279.        parser — Access Python parse trees
  280.        ast — Abstract Syntax Trees
  281.        symtable — Access to the compiler’s symbol tables
  282.        symbol — Constants used with Python parse trees
  283.        token — Constants used with Python parse trees
  284.        keyword — Testing for Python keywords
  285.        tokenize — Tokenizer for Python source
  286.        tabnanny — Detection of ambiguous indentation
  287.        pyclbr — Python class browser support
  288.        py_compile — Compile Python source files
  289.        compileall — Byte-compile Python libraries
  290.        dis — Disassembler for Python bytecode
  291.        pickletools — Tools for pickle developers
  292.    Miscellaneous Services
  293.        formatter — Generic output formatting
  294.    MS Windows Specific Services
  295.        msilib — Read and write Microsoft Installer files
  296.        msvcrt — Useful routines from the MS VC++ runtime
  297.        winreg — Windows registry access
  298.        winsound — Sound-playing interface for Windows
  299.    Unix Specific Services
  300.        posix — The most common POSIX system calls
  301.        pwd — The password database
  302.        spwd — The shadow password database
  303.        grp — The group database
  304.        crypt — Function to check Unix passwords
  305.        termios — POSIX style tty control
  306.        tty — Terminal control functions
  307.        pty — Pseudo-terminal utilities
  308.        fcntl — The fcntl and ioctl system calls
  309.        pipes — Interface to shell pipelines
  310.        resource — Resource usage information
  311.        nis — Interface to Sun’s NIS (Yellow Pages)
  312.        syslog — Unix syslog library routines
  313.    Superseded Modules
  314.        optparse — Parser for command line options
  315.        imp — Access the import internals
  316.    Undocumented Modules
  317.        Platform specific modules
Add Comment
Please, Sign In to add comment