Python, in addition to keywords (keywords) and built-in types and functions (Builtins), more functionality is provided through the libraries (that is, modules).
The commonly used libraries (modules) are as follows:
1 Python Runtime services
* The Copy:copy module provides the ability to make a shallow copy and a deep copy of a composite (compound) object (List,tuple,dict,custom Class).
* Pickle:pickle modules are used to serialize Python objects to bytes streams, which are suitable for storage to files, network transmissions, or database storage. (The pickle process is also called serializing,marshalling or flattening,pickle can be used to deserialize bytes streams into Python objects).
* The Sys:sys module contains variables and functions related to the Python parser and environment.
* Other: Atexit,gc,inspect,marshal,traceback,types,warnings,weakref.
2) Mathematics
* Float in Decimal:python is represented by a double-precision binary floating-point code that causes decimals to be accurately represented, such as 0.1 actually in memory of 0.100000000000000001, and 3*0.1 = 0.3 to False. The decimal is to solve similar problems, with higher accuracy, can represent a larger range of numbers, more accurate rounding.
* The Math:math module defines standard mathematical methods such as cos (x), sin (x), and so on.
* The Random:random module provides a variety of methods for generating random numbers.
* Other: Fractions,numbers.
3 data structure, algorithm and code simplification
* Array:array represents an array, similar to list, which, unlike list, can only store objects of the same type.
* Bisect:bisect is an ordered list in which the internal use of the binary (bitsection) to achieve most of the operation.
* The Collections:collections module contains a number of useful containers for high-performance implementations, abstract base classes for various containers, and functions to create name-tuple objects. Examples include container deque,defaultdict,namedtuple, etc.
* HEAPQ:HEAPQ is a priority queue that is implemented using the heap.
* Itertools:itertools contains functions that are used to create valid iterators. All functions return iterators or functions that contain iterators (such as generators and generators expression).
* Operator:operator provides access to Python's built-in operations and the special methods provided by the parser, such as x+y Add (x,y), X+=y Iadd (x,y), a% B mod (a,b), and so on.
* Other: Abc,contextlib,functools.
4) string and text processing
The *codecs:codecs module is used to process different character encodings and the conversion of Unicode text IO.
* The Re:re module is used to match and replace regular expressions for strings.
* The String:string module contains a number of useful constants and functions to handle strings. Class that also contains the new string format.
* Struct:struct modules are used to implement transformations between Python and binary architectures.
* Unicodedata:unicodedata module provides access to Unicode character database
5 Python database access
* Relational databases have common specifications Python database API specification v2.0,mysql,oracle and so on all implement this specification, and then increase their own extensions.
* The Sqlite3:sqlite3 module provides an interface for SQLite database access. A SQLite database is a self-contained relational database that exists in the form of a file or memory.
* Dbm-style Database module: Python provides a dozen modules to support UNIX Dbm-style database files. The DBM module is used to read the standard UNIX-DBM database files, gdbm to read the GNU dbm database files, Dbhash to read Berkeley DB database files. All of these modules provide an object that implements a persistent dictionary based on strings, and he is very similar to the dictionary dict, but his keys and values must be strings.
* The Shelve:shelve module uses a special "shelf" object to support persistent objects. This object behaves like Dict, but all of the objects he stores are stored on the hard disk using a Hashtable database (DBHASH,DBM,GDBM). The difference from the DBM module is that the object being stored is not only a string, but can be any pickle-compatible object.
6) file and directory processing
* The BZ2:BZ2 module is used to process files compressed by the BZIP2 compression algorithm.
* The FILECMP:FILECMP module provides functions to compare files and directories.
* The Fnmatch:fnmatch module provides wildcard characters that use Unix shell-style to match file names. This module is just for matching, using Glob to get a matching list of files.
* The Glob:glob module returns all files that match a specified Unix shell wildcard in a directory.
* The Gzip:gzip module provides a class gzipfile to perform reading and writing of files that are compatible with Gnugzip programs.
* Shutil:shutil modules are used to perform higher-level file operations, such as copying, deletion, renaming. The shutil operation is for general files and does not support file types such as Pipes,block devices.
* The Tarfile:tarfile module is used to maintain tar archive files. Tar does not have a compression function.
* The Tempfile:tempfile module is used to generate temporary files and file names.
* Zipfile:zipfile module is used to process files in zip format.
* The Zlib,zlib module provides access to the compression capabilities of the Zlib library.
7 Service of the operating system
* The Cmmands:commands module is used to perform simple system commands, which are passed in as strings and return the output of the command as a string. However, this module is only available on UNIX systems.
* Configparser,configparser module is used to read and write the configuration file in Windows INI format.
* The Datetime,datetime module provides a variety of types to represent and process dates and times.
* errno, defines all the errorcode corresponding symbolic names.
* The Io,io module implements various IO forms and built-in open () functions.
* Logging, the logging module is flexible and easy to record events,errors,warnings and debuging information to the application. The log information can be collected, filtered, written to a file or system log, and even sent over the network to a remote machine.
The *mmap,mmap module provides support for memory-mapped file objects that use a memory-mapped file similar to the use of a generic file or byte string.
*MSVCRT,MSCRT can only be used in Windows systems to access many useful features of the Visual C Run-time library.
*optparse,optparse module to handle the command line option sys.argv for UNIX style.
* The Os,os module provides a portable (portable) interface for common operating system services. The OS can be considered NT and POSIX abstractions. NT provides Windows service interface, POSIX provides UNIX (LINUX,MAC) service interface.
* The Os.path,os.path module handles path-related operations in a portable manner.
* Signal,signal modules are used to implement signal (signal) processing, often associated with synchronization.
* The Subprocess,subprocess module contains functions and objects to unify the creation of new processes, control the input and output streams of new processes, and process the return of processes.
* The Time,time module provides a variety of time dependent functions. The commonly used Time.sleep ().
* WinReg, the WinReg module is used to manipulate the Windows registry.
* Other: Fcntl.
8) Threads and parallelism
* The Multiprocessing,multiprocessing module provides subprocess to load multiple tasks, communicate, share data, and perform various synchronization operations.
* The Threading,threading module provides a very large number of synchronization methods for thread classes to implement multithreaded programming.
* Queue,queue module implements a variety of multiple producers, multiple consumer queues, is used to achieve the information security exchange of multithreaded routines.
* Other: Coroutines and microthreading.
9 Network programming and sockets (Sockets)
* The Asynchat,asynchat module simplifies the application's network asynchronous processing by encapsulating the Asyncore.
* SSL,SSL modules are used to package socket objects using Secure Sockets Layer (SSL), which enables data encryption and terminal authentication. Python uses OpenSSL to implement this module.
* The Socketserver,socketserver module provides a type that simplifies the implementation of the socket server in the TCP,UDP and UNIX domains.
* Other: Asyncore,select.
Internet application Programming
* The Ftplib,ftplib module implements the FTP client-side protocol. This module is rarely used because the Urllib provides a more advanced interface.
* HTTP package, contains the HTTP client and server implementation and cookies management module.
* Smtplib,smtplib contains the underlying interface of the SMTP client, which is used to send messages using the SMTP protocol.
* The Urllib,urllib package provides an advanced interface for client to interact with HTTP server,ftp server and local files.
* XMLRPC,XMLRPC module implemented XML-RPC client with class.
One) Web programming
* The cgi,cgi module is used to implement CGI scripts, and CGI programs are generally webserver executed to handle user input in form or to generate some dynamic content. When the request with the CGI script is submitted, webserver executes the CGI as a subprocess, and the CGI program obtains the input through the Sys.stdin or the environment variable to output through the sys.stdout.
* The Webbrowser,webbrowser module provides platform-independent tool functions to open documents using Web browser.
* Other: Wsgiref/wsgi (Python Web Server Gateway Interface).
Internet Data processing and coding
* The Base64,base64 module provides a BASE64,BASE32,BASE16 encoding to enable the encoding and decoding of binary and text. Base64 is typically used to encode binary data, which is embedded in the mail or HTTP protocol.
* The BINASCII,BINASCII module provides low-level interfaces for the conversion of binary and various ASCII encodings.
* The Csv,csv module is used to read and write comma-separated values (CSV) files.
* Email,email Package provides a large number of functions and objects to use the MIME standard to represent, parse and maintain email messages.
* The Hashlib,hashlib module implements a variety of secure hash and message digest algorithms, such as MD5 and SHA1.
* Htmlparser (Html.parser), this module defines htmlparser to parse HTML and XHTML documents. With this class, you need to define your own class and inherit from Htmlparser.
* The Json,json module is serialized with the class or the meal serializes JavaScript Object Notation (JSON) objects.
The
* Xml,xml Package provides a variety of ways to work with XML.