Chapter 11. Introduction to the Python Standard Library

PYTHON IS BUNDLED WITH A LARGE COLLECTION of modules collectively known as the Python library. Library modules are used simply via an import statement. For example:

import socket

Automatically generated documentation, collected from documentation strings and source code, can be obtained using the pydoc command (executed as a shell command) or the help() command if running interactively in the Python interpreter. For example:

>>> help(re) Help on module re: NAME re - Minimal "re" compatibility wrapper. See "sre" for documentation. FILE /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/re.py MODULE DOCS http://www.python.org/doc/current/lib/module-re.html CLASSES exceptions.Exception ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.