Standard Library Modules
Standard library modules are always available but must be imported to be used in client modules. To access them, use one of these formats:
import module, and fetch attribute names (
from module import name, and use module names unqualified (
from module import *, and use module names unqualified (
For instance, to use name
sys module, either use
import sys and name
sys.argv, or use
sys import argv and name
There are many standard library modules; the following sections are not necessarily exhaustive, and aim to document only commonly used names in commonly used modules. See Python’s Library Reference for a more complete reference to standard library modules.
In all of the following module sections:
Listed export names followed by parentheses are functions that must be called; others are simple attributes (i.e., variable names in modules).
Module contents document the modules’ state Python 3.0; see Python manuals for information on attributes unique to version 2 or 3.