- Front Matter
- Contents
- 1. Whetting Your Appetite
2. Using the Python Interpreter
3. An Informal Introduction to Python
4. More Control Flow Tools
5. Data Structures
6. Modules
7. Input and Output
8. Errors and Exceptions
9. Classes
10. Brief Tour of the Standard Library
- 10.1 Operating System Interface
- 10.2 File Wildcards
- 10.3 Command Line Arguments
- 10.4 Error Output Redirection and Program Termination
- 10.5 String Pattern Matching
- 10.6 Mathematics
- 10.7 Internet Access
- 10.8 Dates and Times
- 10.9 Data Compression
- 10.10 Performance Measurement
- 10.11 Quality Control
- 10.12 Batteries Included
11. Brief Tour of the Standard Library - Part II
- 12. What Now?
A. Interactive Input Editing and History Substitution
B. Floating Point Arithmetic: Issues and Limitations
C. History and License
- D. Glossary
- Index
- About this document ...
- Front Matter
- Contents
1. Introduction
2. Lexical analysis
3. Data model
4. Execution model
5. Expressions
6. Simple statements
- 6.1 Expression statements
- 6.2 Assert statements
6.3 Assignment statements
- 6.4 The pass statement
- 6.5 The del statement
- 6.6 The print statement
- 6.7 The return statement
- 6.8 The yield statement
- 6.9 The raise statement
- 6.10 The break statement
- 6.11 The continue statement
6.12 The import statement
- 6.13 The global statement
- 6.14 The exec statement
7. Compound statements
8. Top-level components
A. History and License
- Index
- About this document ...
- 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
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
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 ...
- Front Matter
- Contents
1. Introduction
- 2. The Very High Level Layer
- 3. Reference Counting
4. Exception Handling
5. Utilities
6. Abstract Objects Layer
7. Concrete Objects Layer
8. Initialization, Finalization, and Threads
9. Memory Management
10. Object Implementation Support
- A. Reporting Bugs
B. History and License
- Index
- About this document ...
- Front Matter
- Contents
1. Extending Python with C or C++
- 1.1 A Simple Example
- 1.2 Intermezzo: Errors and Exceptions
- 1.3 Back to the Example
- 1.4 The Module's Method Table and Initialization Function
- 1.5 Compilation and Linkage
- 1.6 Calling Python Functions from C
- 1.7 Extracting Parameters in Extension Functions
- 1.8 Keyword Parameters for Extension Functions
- 1.9 Building Arbitrary Values
1.10 Reference Counts
- 1.11 Writing Extensions in C++
- 1.12 Providing a C API for an Extension Module
2. Defining New Types
3. Building C and C++ Extensions with distutils
4. Building C and C++ Extensions on Windows
5. Embedding Python in Another Application
- A. Reporting Bugs
B. History and License
- About this document ...
- __builtin__
- __future__
- __main__
- _winreg (Windows)
- aepack (Mac)
- aetools (Mac)
- aetypes (Mac)
- aifc
- AL (IRIX)
- al (IRIX)
- anydbm
- applesingle (Mac)
- array
- asynchat
- asyncore
- atexit
- audioop
- autoGIL (Mac)
- base64
- BaseHTTPServer
- Bastion
- binascii
- binhex
- bisect
- bsddb (Unix, Windows)
- buildtools (Mac)
- bz2
- calendar
- Carbon.AE (Mac)
- Carbon.AH (Mac)
- Carbon.App (Mac)
- Carbon.CaronEvt (Mac)
- Carbon.CF (Mac)
- Carbon.CG (Mac)
- Carbon.Cm (Mac)
- Carbon.Ctl (Mac)
- Carbon.Dlg (Mac)
- Carbon.Evt (Mac)
- Carbon.Fm (Mac)
- Carbon.Folder (Mac)
- Carbon.Help (Mac)
- Carbon.List (Mac)
- Carbon.Menu (Mac)
- Carbon.Mlte (Mac)
- Carbon.Qd (Mac)
- Carbon.Qdoffs (Mac)
- Carbon.Qt (Mac)
- Carbon.Res (Mac)
- Carbon.Scrap (Mac)
- Carbon.Snd (Mac)
- Carbon.TE (Mac)
- Carbon.Win (Mac)
- cd (IRIX)
- cfmfile (Mac)
- cgi
- CGIHTTPServer
- cgitb
- chunk
- cmath
- cmd
- code
- codecs
- codeop
- collections
- ColorPicker (Mac)
- colorsys
- commands (Unix)
- compileall
- compiler
- compiler.ast
- compiler.visitor
- ConfigParser
- contextlib
- Cookie
- cookielib
- copy
- copy_reg
- cPickle
- cProfile
- crypt (Unix)
- cStringIO
- csv
- ctypes
- curses
- curses.ascii
- curses.panel
- curses.textpad
- curses.wrapper
- datetime
- dbhash (Unix, Windows)
- dbm (Unix)
- decimal
- DEVICE (IRIX)
- difflib
- dircache
- dis
- distutils
- distutils.archive_util
- distutils.bcppcompiler
- distutils.ccompiler
- distutils.cmd
- distutils.command
- distutils.command.bdist
- distutils.command.bdist_dumb
- distutils.command.bdist_packager
- distutils.command.bdist_rpm
- distutils.command.bdist_wininst
- distutils.command.build
- distutils.command.build_clib
- distutils.command.build_ext
- distutils.command.build_py
- distutils.command.build_scripts
- distutils.command.clean
- distutils.command.config
- distutils.command.install
- distutils.command.install_data
- distutils.command.install_headers
- distutils.command.install_lib
- distutils.command.install_scripts
- distutils.command.register
- distutils.command.sdist
- distutils.core
- distutils.cygwinccompiler
- distutils.debug
- distutils.dep_util
- distutils.dir_util
- distutils.dist
- distutils.emxccompiler
- distutils.errors
- distutils.extension
- distutils.fancy_getopt
- distutils.file_util
- distutils.filelist
- distutils.log
- distutils.msvccompiler
- distutils.mwerkscompiler
- distutils.spawn
- distutils.sysconfig
- distutils.text_file
- distutils.unixccompiler
- distutils.util
- distutils.version
- dl (Unix)
- doctest
- DocXMLRPCServer
- dumbdbm
- dummy_thread
- dummy_threading
- EasyDialogs (Mac)
- email.charset
- email.encoders
- email.errors
- email.generator
- email.header
- email.iterators
- email.message
- email.mime
- email.mime.audio
- email.mime.base
- email.mime.image
- email.mime.message
- email.mime.multipart
- email.mime.nonmultipart
- email.mime.text
- email.parser
- email.utils
- encodings.idna
- errno
- exceptions
- fcntl (Unix)
- filecmp
- fileinput
- findertools (Mac)
- FL (IRIX)
- fl (IRIX)
- flp (IRIX)
- fm (IRIX)
- fnmatch
- formatter
- fpectl (Unix)
- fpformat
- FrameWork (Mac)
- ftplib
- functools
- gc
- gdbm (Unix)
- gensuitemodule (Mac)
- getopt
- getpass
- gettext
- GL (IRIX)
- gl (IRIX)
- glob
- gopherlib
- grp (Unix)
- gzip
- hashlib
- heapq
- hmac
- hotshot
- hotshot.stats
- htmlentitydefs
- htmllib
- HTMLParser
- httplib
- ic (Mac)
- icopen (Mac)
- imageop
- imaplib
- imgfile (IRIX)
- imghdr
- imp
- inspect
- itertools
- jpeg (IRIX)
- keyword
- linecache
- locale
- logging
- macerrors (Mac)
- macfs (Mac)
- MacOS (Mac)
- macostools (Mac)
- macpath
- macresource (Mac)
- mailbox
- mailcap
- marshal
- math
- md5
- mhlib
- mimetools
- mimetypes
- MimeWriter
- mimify
- MiniAEFrame (Mac)
- mmap
- modulefinder
- msilib (Windows)
- msvcrt (Windows)
- multifile
- mutex
- Nav (Mac)
- netrc
- new
- nis (UNIX)
- nntplib
- operator
- optparse
- os
- os.path
- ossaudiodev (Linux, FreeBSD)
- parser
- pdb
- pickle
- pickletools
- pipes (Unix)
- PixMapWrapper (Mac)
- pkgutil
- platform
- popen2 (Unix, Windows)
- poplib
- posix (Unix)
- posixfile (Unix)
- pprint
- profile
- pstats
- pty (IRIX, Linux)
- pwd (Unix)
- py_compile
- pyclbr
- pydoc
- Queue
- quopri
- random
- re
- readline (Unix)
- repr
- resource (Unix)
- rexec
- rfc822
- rgbimg
- rlcompleter
- robotparser
- runpy
- sched
- ScrolledText (Tk)
- select
- sets
- sgmllib
- sha
- shelve
- shlex
- shutil
- signal
- SimpleHTTPServer
- SimpleXMLRPCServer
- site
- smtpd
- smtplib
- sndhdr
- socket
- SocketServer
- spwd (Unix)
- sqlite3
- stat
- statvfs
- string
- StringIO
- stringprep
- struct
- subprocess
- sunau
- SUNAUDIODEV (SunOS)
- sunaudiodev (SunOS)
- symbol
- sys
- syslog (Unix)
- tabnanny
- tarfile
- telnetlib
- tempfile
- termios (Unix)
- test
- test.test_support
- textwrap
- thread
- threading
- time
- timeit
- Tix
- Tkinter
- token
- tokenize
- trace
- traceback
- tty (Unix)
- turtle (Tk)
- types
- unicodedata
- unittest
- urllib
- urllib2
- urlparse
- user
- UserDict
- UserList
- UserString
- uu
- uuid
- videoreader (Mac)
- W (Mac)
- warnings
- wave
- weakref
- webbrowser
- whichdb
- winsound (Windows)
- wsgiref
- wsgiref.handlers
- wsgiref.headers
- wsgiref.simple_server
- wsgiref.util
- wsgiref.validate
- xdrlib
- xml.dom
- xml.dom.minidom
- xml.dom.pulldom
- xml.etree.ElementTree
- xml.parsers.expat
- xml.sax
- xml.sax.handler
- xml.sax.saxutils
- xml.sax.xmlreader
- xmlrpclib
- zipfile
- zipimport
- zlib