CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Mon, 04 Aug 2025 12:00:39 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20080915212640
location: https://web.archive.org/web/20080915212640/https://www.python.org/doc/lib/lib.html
server-timing: captures_list;dur=0.924079, exclusion.robots;dur=0.028299, exclusion.robots.policy;dur=0.013884, esindex;dur=0.017136, cdx.remote;dur=2.392963, LoadShardBlock;dur=161.055040, PetaboxLoader3.datanode;dur=56.331307
x-app-server: wwwb-app213
x-ts: 302
x-tr: 192
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app213; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Mon, 04 Aug 2025 12:00:40 GMT
content-type: text/html
x-archive-orig-date: Mon, 15 Sep 2008 21:26:40 GMT
x-archive-orig-server: Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_wsgi/2.0 Python/2.4.4
x-archive-orig-last-modified: Fri, 22 Feb 2008 12:57:43 GMT
x-archive-orig-etag: "1300c7-11ba5-c499ffc0"
x-archive-orig-accept-ranges: bytes
x-archive-orig-content-length: 72613
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Mon, 15 Sep 2008 21:26:40 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Thu, 01 May 1997 01:53:31 GMT", ; rel="prev memento"; datetime="Wed, 14 May 2008 17:34:02 GMT", ; rel="memento"; datetime="Mon, 15 Sep 2008 21:26:40 GMT", ; rel="next memento"; datetime="Tue, 16 Dec 2008 16:13:16 GMT", ; rel="last memento"; datetime="Thu, 22 May 2025 14:08:34 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_5_20080915190249_crawl104-c/51_5_20080915212522_crawl107.arc.gz
server-timing: captures_list;dur=2.401732, exclusion.robots;dur=0.024252, exclusion.robots.policy;dur=0.011085, esindex;dur=0.011344, cdx.remote;dur=35.359098, LoadShardBlock;dur=220.253667, PetaboxLoader3.datanode;dur=121.410552, load_resource;dur=160.174459, PetaboxLoader3.resolve;dur=104.657289
x-app-server: wwwb-app213
x-ts: 200
x-tr: 527
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
Python Library Reference
Release 2.5.2, documentation updated on 21st February, 2008.
See About this document... for information on suggesting changes.
Python Library Reference
Guido van Rossum
Python Software Foundation
Email: docs@python.org
Fred L. Drake, Jr., editor
Release 2.5.2
21st February, 2008
- Front Matter
- Contents
- 1. Introduction
- 2. Built-in Objects
- 3. Built-in Types
- 3.1 Truth Value Testing
- 3.2 Boolean Operations -- and, or, not
- 3.3 Comparisons
- 3.4 Numeric Types -- int, float, long, complex
- 3.5 Iterator Types
- 3.6 Sequence Types -- str, unicode, list, tuple, buffer, xrange
- 3.7 Set Types -- set, frozenset
- 3.8 Mapping Types -- dict
- 3.9 File Objects
- 3.10 Context Manager Types
- 3.11 Other Built-in Types
- 3.12 Special Attributes
- 4. String Services
- 4.1 string -- Common string operations
- 4.2 re -- Regular expression operations
- 4.3 struct -- Interpret strings as packed binary data
- 4.4 difflib -- Helpers for computing deltas
- 4.5 StringIO -- Read and write strings as files
- 4.6 cStringIO -- Faster version of StringIO
- 4.7 textwrap -- Text wrapping and filling
- 4.8 codecs -- Codec registry and base classes
- 4.9 unicodedata -- Unicode Database
- 4.10 stringprep -- Internet String Preparation
- 4.11 fpformat -- Floating point conversions
- 5. Data Types
- 5.1 datetime -- Basic date and time types
- 5.2 calendar -- General calendar-related functions
- 5.3 collections -- High-performance container datatypes
- 5.4 heapq -- Heap queue algorithm
- 5.5 bisect -- Array bisection algorithm
- 5.6 array -- Efficient arrays of numeric values
- 5.7 sets -- Unordered collections of unique elements
- 5.8 sched -- Event scheduler
- 5.9 mutex -- Mutual exclusion support
- 5.10 Queue -- A synchronized queue class
- 5.11 weakref -- Weak references
- 5.12 UserDict -- Class wrapper for dictionary objects
- 5.13 UserList -- Class wrapper for list objects
- 5.14 UserString -- Class wrapper for string objects
- 5.15 types -- Names for built-in types
- 5.16 new -- Creation of runtime internal objects
- 5.17 copy -- Shallow and deep copy operations
- 5.18 pprint -- Data pretty printer
- 5.19 repr -- Alternate repr() implementation
- 6. Numeric and Mathematical Modules
- 6.1 math -- Mathematical functions
- 6.2 cmath -- Mathematical functions for complex numbers
- 6.3 decimal -- Decimal floating point arithmetic
- 6.4 random -- Generate pseudo-random numbers
- 6.5 itertools -- Functions creating iterators for efficient looping
- 6.6 functools -- Higher order functions and operations on callable objects.
- 6.7 operator -- Standard operators as functions.
- 7. Internet Data Handling
- 7.1 email --
An email and MIME handling package
- 7.1.1 Representing an email message
- 7.1.2 Parsing email messages
- 7.1.3 Generating MIME documents
- 7.1.4 Creating email and MIME objects from scratch
- 7.1.5 Internationalized headers
- 7.1.6 Representing character sets
- 7.1.7 Encoders
- 7.1.8 Exception and Defect classes
- 7.1.9 Miscellaneous utilities
- 7.1.10 Iterators
- 7.1.11 Package History
- 7.1.12 Differences from mimelib
- 7.1.13 Examples
- 7.2 mailcap -- Mailcap file handling.
- 7.3 mailbox -- Manipulate mailboxes in various formats
- 7.4 mhlib -- Access to MH mailboxes
- 7.5 mimetools -- Tools for parsing MIME messages
- 7.6 mimetypes -- Map filenames to MIME types
- 7.7 MimeWriter -- Generic MIME file writer
- 7.8 mimify -- MIME processing of mail messages
- 7.9 multifile -- Support for files containing distinct parts
- 7.10 rfc822 -- Parse RFC 2822 mail headers
- 7.11 base64 -- RFC 3548: Base16, Base32, Base64 Data Encodings
- 7.12 binhex -- Encode and decode binhex4 files
- 7.13 binascii -- Convert between binary and ASCII
- 7.14 quopri -- Encode and decode MIME quoted-printable data
- 7.15 uu -- Encode and decode uuencode files
- 7.1 email --
An email and MIME handling package
- 8. Structured Markup Processing Tools
- 8.1 HTMLParser -- Simple HTML and XHTML parser
- 8.2 sgmllib -- Simple SGML parser
- 8.3 htmllib -- A parser for HTML documents
- 8.4 htmlentitydefs -- Definitions of HTML general entities
- 8.5 xml.parsers.expat -- Fast XML parsing using Expat
- 8.6 xml.dom -- The Document Object Model API
- 8.7 xml.dom.minidom -- Lightweight DOM implementation
- 8.8 xml.dom.pulldom -- Support for building partial DOM trees
- 8.9 xml.sax -- Support for SAX2 parsers
- 8.10 xml.sax.handler -- Base classes for SAX handlers
- 8.11 xml.sax.saxutils -- SAX Utilities
- 8.12 xml.sax.xmlreader -- Interface for XML parsers
- 8.13 xml.etree.ElementTree -- The ElementTree XML API
- 9. File Formats
- 10. Cryptographic Services
- 11. File and Directory Access
- 11.1 os.path -- Common pathname manipulations
- 11.2 fileinput -- Iterate over lines from multiple input streams
- 11.3 stat -- Interpreting stat() results
- 11.4 statvfs -- Constants used with os.statvfs()
- 11.5 filecmp -- File and Directory Comparisons
- 11.6 tempfile -- Generate temporary files and directories
- 11.7 glob -- Unix style pathname pattern expansion
- 11.8 fnmatch -- Unix filename pattern matching
- 11.9 linecache -- Random access to text lines
- 11.10 shutil -- High-level file operations
- 11.11 dircache -- Cached directory listings
- 12. Data Compression and Archiving
- 13. Data Persistence
- 13.1 pickle -- Python object serialization
- 13.2 cPickle -- A faster pickle
- 13.3 copy_reg -- Register pickle support functions
- 13.4 shelve -- Python object persistence
- 13.5 marshal -- Internal Python object serialization
- 13.6 anydbm -- Generic access to DBM-style databases
- 13.7 whichdb -- Guess which DBM module created a database
- 13.8 dbm -- Simple ``database'' interface
- 13.9 gdbm -- GNU's reinterpretation of dbm
- 13.10 dbhash -- DBM-style interface to the BSD database library
- 13.11 bsddb -- Interface to Berkeley DB library
- 13.12 dumbdbm -- Portable DBM implementation
- 13.13 sqlite3 -- DB-API 2.0 interface for SQLite databases
- 14. Generic Operating System Services
- 14.1 os -- Miscellaneous operating system interfaces
- 14.2 time -- Time access and conversions
- 14.3 optparse -- More powerful command line option parser
- 14.4 getopt -- Parser for command line options
- 14.5 logging -- Logging facility for Python
- 14.6 getpass -- Portable password input
- 14.7 curses -- Terminal handling for character-cell displays
- 14.8 curses.textpad -- Text input widget for curses programs
- 14.9 curses.wrapper -- Terminal handler for curses programs
- 14.10 curses.ascii -- Utilities for ASCII characters
- 14.11 curses.panel -- A panel stack extension for curses.
- 14.12 platform -- Access to underlying platform's identifying data.
- 14.13 errno -- Standard errno system symbols
- 14.14 ctypes -- A foreign function library for Python.
- 15. Optional Operating System Services
- 15.1 select -- Waiting for I/O completion
- 15.2 thread -- Multiple threads of control
- 15.3 threading -- Higher-level threading interface
- 15.4 dummy_thread -- Drop-in replacement for the thread module
- 15.5 dummy_threading -- Drop-in replacement for the threading module
- 15.6 mmap -- Memory-mapped file support
- 15.7 readline -- GNU readline interface
- 15.8 rlcompleter -- Completion function for GNU readline
- 16. Unix Specific Services
- 16.1 posix -- The most common POSIX system calls
- 16.2 pwd -- The password database
- 16.3 spwd -- The shadow password database
- 16.4 grp -- The group database
- 16.5 crypt -- Function to check Unix passwords
- 16.6 dl -- Call C functions in shared objects
- 16.7 termios -- POSIX style tty control
- 16.8 tty -- Terminal control functions
- 16.9 pty -- Pseudo-terminal utilities
- 16.10 fcntl -- The fcntl() and ioctl() system calls
- 16.11 pipes -- Interface to shell pipelines
- 16.12 posixfile -- File-like objects with locking support
- 16.13 resource -- Resource usage information
- 16.14 nis -- Interface to Sun's NIS (Yellow Pages)
- 16.15 syslog -- Unix syslog library routines
- 16.16 commands -- Utilities for running commands
- 17. Interprocess Communication and Networking
- 17.1 subprocess -- Subprocess management
- 17.2 socket -- Low-level networking interface
- 17.3 signal -- Set handlers for asynchronous events
- 17.4 popen2 -- Subprocesses with accessible I/O streams
- 17.5 asyncore -- Asynchronous socket handler
- 17.6 asynchat -- Asynchronous socket command/response handler
- 18. Internet Protocols and Support
- 18.1 webbrowser -- Convenient Web-browser controller
- 18.2 cgi -- Common Gateway Interface support.
- 18.3 cgitb -- Traceback manager for CGI scripts
- 18.4 wsgiref -- WSGI Utilities and Reference Implementation
- 18.5 urllib -- Open arbitrary resources by URL
- 18.6 urllib2 --
extensible library for opening URLs
- 18.6.1 Request Objects
- 18.6.2 OpenerDirector Objects
- 18.6.3 BaseHandler Objects
- 18.6.4 HTTPRedirectHandler Objects
- 18.6.5 HTTPCookieProcessor Objects
- 18.6.6 ProxyHandler Objects
- 18.6.7 HTTPPasswordMgr Objects
- 18.6.8 AbstractBasicAuthHandler Objects
- 18.6.9 HTTPBasicAuthHandler Objects
- 18.6.10 ProxyBasicAuthHandler Objects
- 18.6.11 AbstractDigestAuthHandler Objects
- 18.6.12 HTTPDigestAuthHandler Objects
- 18.6.13 ProxyDigestAuthHandler Objects
- 18.6.14 HTTPHandler Objects
- 18.6.15 HTTPSHandler Objects
- 18.6.16 FileHandler Objects
- 18.6.17 FTPHandler Objects
- 18.6.18 CacheFTPHandler Objects
- 18.6.19 GopherHandler Objects
- 18.6.20 UnknownHandler Objects
- 18.6.21 HTTPErrorProcessor Objects
- 18.6.22 Examples
- 18.7 httplib -- HTTP protocol client
- 18.8 ftplib -- FTP protocol client
- 18.9 gopherlib -- Gopher protocol client
- 18.10 poplib -- POP3 protocol client
- 18.11 imaplib -- IMAP4 protocol client
- 18.12 nntplib -- NNTP protocol client
- 18.13 smtplib -- SMTP protocol client
- 18.14 smtpd -- SMTP Server
- 18.15 telnetlib -- Telnet client
- 18.16 uuid -- UUID objects according to RFC 4122
- 18.17 urlparse -- Parse URLs into components
- 18.18 SocketServer -- A framework for network servers
- 18.19 BaseHTTPServer -- Basic HTTP server
- 18.20 SimpleHTTPServer -- Simple HTTP request handler
- 18.21 CGIHTTPServer -- CGI-capable HTTP request handler
- 18.22 cookielib -- Cookie handling for HTTP clients
- 18.23 Cookie -- HTTP state management
- 18.24 xmlrpclib -- XML-RPC client access
- 18.25 SimpleXMLRPCServer -- Basic XML-RPC server
- 18.26 DocXMLRPCServer -- Self-documenting XML-RPC server
- 19. Multimedia Services
- 19.1 audioop -- Manipulate raw audio data
- 19.2 imageop -- Manipulate raw image data
- 19.3 aifc -- Read and write AIFF and AIFC files
- 19.4 sunau -- Read and write Sun AU files
- 19.5 wave -- Read and write WAV files
- 19.6 chunk -- Read IFF chunked data
- 19.7 colorsys -- Conversions between color systems
- 19.8 rgbimg -- Read and write ``SGI RGB'' files
- 19.9 imghdr -- Determine the type of an image
- 19.10 sndhdr -- Determine type of sound file
- 19.11 ossaudiodev -- Access to OSS-compatible audio devices
- 20. Graphical User Interfaces with Tk
- 21. Internationalization
- 22. Program Frameworks
- 23. Development Tools
- 24. The Python Debugger
- 25. The Python Profilers
- 25.1 Introduction to the profilers
- 25.2 Instant User's Manual
- 25.3 What Is Deterministic Profiling?
- 25.4 Reference Manual - profile and cProfile
- 25.5 Limitations
- 25.6 Calibration
- 25.7 Extensions -- Deriving Better Profilers
- 25.8 hotshot -- High performance logging profiler
- 25.9 timeit -- Measure execution time of small code snippets
- 25.10 trace -- Trace or track Python statement execution
- 26. Python Runtime Services
- 26.1 sys -- System-specific parameters and functions
- 26.2 __builtin__ -- Built-in objects
- 26.3 __main__ -- Top-level script environment
- 26.4 warnings -- Warning control
- 26.5 contextlib -- Utilities for with-statement contexts.
- 26.6 atexit -- Exit handlers
- 26.7 traceback -- Print or retrieve a stack traceback
- 26.8 __future__ -- Future statement definitions
- 26.9 gc -- Garbage Collector interface
- 26.10 inspect -- Inspect live objects
- 26.11 site -- Site-specific configuration hook
- 26.12 user -- User-specific configuration hook
- 26.13 fpectl -- Floating point exception control
- 27. Custom Python Interpreters
- 28. Restricted Execution
- 29. Importing Modules
- 30. Python Language Services
- 30.1 parser -- Access Python parse trees
- 30.2 symbol -- Constants used with Python parse trees
- 30.3 token -- Constants used with Python parse trees
- 30.4 keyword -- Testing for Python keywords
- 30.5 tokenize -- Tokenizer for Python source
- 30.6 tabnanny -- Detection of ambiguous indentation
- 30.7 pyclbr -- Python class browser support
- 30.8 py_compile -- Compile Python source files
- 30.9 compileall -- Byte-compile Python libraries
- 30.10 dis -- Disassembler for Python byte code
- 30.11 pickletools -- Tools for pickle developers.
- 30.12 distutils -- Building and installing Python modules
- 31. Python compiler package
- 32. Abstract Syntax Trees
- 33. Miscellaneous Services
- 34. SGI IRIX Specific Services
- 34.1 al -- Audio functions on the SGI
- 34.2 AL -- Constants used with the al module
- 34.3 cd -- CD-ROM access on SGI systems
- 34.4 fl -- FORMS library for graphical user interfaces
- 34.5 FL -- Constants used with the fl module
- 34.6 flp -- Functions for loading stored FORMS designs
- 34.7 fm -- Font Manager interface
- 34.8 gl -- Graphics Library interface
- 34.9 DEVICE -- Constants used with the gl module
- 34.10 GL -- Constants used with the gl module
- 34.11 imgfile -- Support for SGI imglib files
- 34.12 jpeg -- Read and write JPEG files
- 35. SunOS Specific Services
- 36. MS Windows Specific Services
- A. Undocumented Modules
- B. Reporting Bugs
- C. History and License
- Module Index
- Index
- About this document ...
Release 2.5.2, documentation updated on 21st February, 2008.