- 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. What Now?
A. Interactive Input Editing and History Substitution
B. Floating Point Arithmetic: Issues and Limitations
C. History and License
- 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. Future statements and nested scopes
B. History and License
- Index
- About this document ...
- Front Matter
- Contents
- 1. Introduction
2. Built-in Functions, Types, and Exceptions
3. Python Runtime Services
- 3.1 sys -- System-specific parameters and functions
- 3.2 gc -- Garbage Collector interface
3.3 weakref -- Weak references
3.4 fpectl -- Floating point exception control
3.5 atexit -- Exit handlers
- 3.6 types -- Names for all built-in types
- 3.7 UserDict -- Class wrapper for dictionary objects
- 3.8 UserList -- Class wrapper for list objects
- 3.9 UserString -- Class wrapper for string objects
3.10 operator -- Standard operators as functions.
3.11 inspect -- Inspect live objects
3.12 traceback -- Print or retrieve a stack traceback
- 3.13 linecache -- Random access to text lines
3.14 pickle -- Python object serialization
- 3.15 cPickle -- A faster pickle
- 3.16 copy_reg -- Register pickle support functions
- 3.17 shelve -- Python object persistence
- 3.18 copy -- Shallow and deep copy operations
- 3.19 marshal -- Internal Python object serialization
3.20 warnings -- Warning control
3.21 imp -- Access the import internals
3.22 code -- Interpreter base classes
- 3.23 codeop -- Compile Python code
3.24 pprint -- Data pretty printer
3.25 repr -- Alternate repr() implementation
- 3.26 new -- Creation of runtime internal objects
- 3.27 site -- Site-specific configuration hook
- 3.28 user -- User-specific configuration hook
- 3.29 __builtin__ -- Built-in functions
- 3.30 __main__ -- Top-level script environment
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 fpformat -- Floating point conversions
- 4.6 StringIO -- Read and write strings as files
- 4.7 cStringIO -- Faster version of StringIO
4.8 codecs -- Codec registry and base classes
- 4.9 unicodedata -- Unicode Database
5. Miscellaneous Services
- 5.1 pydoc -- Documentation generator and online help system
5.2 doctest -- Test docstrings represent reality
5.3 unittest -- Unit testing framework
- 5.4 math -- Mathematical functions
- 5.5 cmath -- Mathematical functions for complex numbers
- 5.6 random -- Generate pseudo-random numbers
- 5.7 whrandom -- Pseudo-random number generator
5.8 bisect -- Array bisection algorithm
- 5.9 array -- Efficient arrays of numeric values
5.10 ConfigParser -- Configuration file parser
- 5.11 fileinput -- Iterate over lines from multiple input streams
- 5.12 xreadlines -- Efficient iteration over a file
- 5.13 calendar -- General calendar-related functions
5.14 cmd -- Support for line-oriented command interpreters
5.15 shlex -- Simple lexical analysis
6. Generic Operating System Services
6.1 os -- Miscellaneous operating system interfaces
- 6.2 os.path -- Common pathname manipulations
- 6.3 dircache -- Cached directory listings
- 6.4 stat -- Interpreting stat() results
- 6.5 statcache -- An optimization of os.stat()
- 6.6 statvfs -- Constants used with os.statvfs()
6.7 filecmp -- File and Directory Comparisons
6.8 popen2 -- Subprocesses with accessible I/O streams
- 6.9 time -- Time access and conversions
6.10 sched -- Event scheduler
6.11 mutex -- Mutual exclusion support
- 6.12 getpass -- Portable password input
6.13 curses -- Terminal handling for character-cell displays
6.14 curses.textpad -- Text input widget for curses programs
- 6.15 curses.wrapper -- Terminal handler for curses programs
- 6.16 curses.ascii -- Utilities for ASCII characters
6.17 curses.panel -- A panel stack extension for curses.
- 6.18 getopt -- Parser for command line options
- 6.19 tempfile -- Generate temporary file names
- 6.20 errno -- Standard errno system symbols
- 6.21 glob -- Unix style pathname pattern expansion
- 6.22 fnmatch -- Unix filename pattern matching
6.23 shutil -- High-level file operations
6.24 locale -- Internationalization services
6.25 gettext -- Multilingual internationalization services
7. Optional Operating System Services
7.1 signal -- Set handlers for asynchronous events
7.2 socket -- Low-level networking interface
7.3 select -- Waiting for I/O completion
- 7.4 thread -- Multiple threads of control
7.5 threading -- Higher-level threading interface
7.6 Queue -- A synchronized queue class
- 7.7 mmap -- Memory-mapped file support
- 7.8 anydbm -- Generic access to DBM-style databases
- 7.9 dumbdbm -- Portable DBM implementation
7.10 dbhash -- DBM-style interface to the BSD database library
- 7.11 whichdb -- Guess which DBM module created a database
7.12 bsddb -- Interface to Berkeley DB library
- 7.13 zlib -- Compression compatible with gzip
- 7.14 gzip -- Support for gzip files
7.15 zipfile -- Work with ZIP archives
7.16 readline -- GNU readline interface
7.17 rlcompleter -- Completion function for GNU readline
8. Unix Specific Services
8.1 posix -- The most common POSIX system calls
- 8.2 pwd -- The password database
- 8.3 grp -- The group database
- 8.4 crypt -- Function to check Unix passwords
8.5 dl -- Call C functions in shared objects
- 8.6 dbm -- Simple ``database'' interface
- 8.7 gdbm -- GNU's reinterpretation of dbm
8.8 termios -- POSIX style tty control
- 8.9 TERMIOS -- Constants used with the termios module
- 8.10 tty -- Terminal control functions
- 8.11 pty -- Pseudo-terminal utilities
- 8.12 fcntl -- The fcntl() and ioctl() system calls
8.13 pipes -- Interface to shell pipelines
- 8.14 posixfile -- File-like objects with locking support
8.15 resource -- Resource usage information
- 8.16 nis -- Interface to Sun's NIS (Yellow Pages)
- 8.17 syslog -- Unix syslog library routines
- 8.18 commands -- Utilities for running commands
9. The Python Debugger
10. The Python Profiler
11. Internet Protocols and Support
11.1 webbrowser -- Convenient Web-browser controller
11.2 cgi -- Common Gateway Interface support.
- 11.3 cgitb -- Traceback manager for CGI scripts
11.4 urllib -- Open arbitrary resources by URL
11.5 urllib2 -- extensible library for opening URLs
- 11.5.1 Request Objects
- 11.5.2 OpenerDirector Objects
- 11.5.3 BaseHandler Objects
- 11.5.4 HTTPRedirectHandler Objects
- 11.5.5 ProxyHandler Objects
- 11.5.6 HTTPPasswordMgr Objects
- 11.5.7 AbstractBasicAuthHandler Objects
- 11.5.8 HTTPBasicAuthHandler Objects
- 11.5.9 ProxyBasicAuthHandler Objects
- 11.5.10 AbstractDigestAuthHandler Objects
- 11.5.11 HTTPDigestAuthHandler Objects
- 11.5.12 ProxyDigestAuthHandler Objects
- 11.5.13 HTTPHandler Objects
- 11.5.14 HTTPSHandler Objects
- 11.5.15 FileHandler Objects
- 11.5.16 FTPHandler Objects
- 11.5.17 CacheFTPHandler Objects
- 11.5.18 GopherHandler Objects
- 11.5.19 UnknownHandler Objects
11.6 httplib -- HTTP protocol client
11.7 ftplib -- FTP protocol client
- 11.8 gopherlib -- Gopher protocol client
11.9 poplib -- POP3 protocol client
11.10 imaplib -- IMAP4 protocol client
11.11 nntplib -- NNTP protocol client
11.12 smtplib -- SMTP protocol client
11.13 telnetlib -- Telnet client
- 11.14 urlparse -- Parse URLs into components
- 11.15 SocketServer -- A framework for network servers
- 11.16 BaseHTTPServer -- Basic HTTP server
- 11.17 SimpleHTTPServer -- Simple HTTP request handler
- 11.18 CGIHTTPServer -- CGI-capable HTTP request handler
11.19 Cookie -- HTTP state management
11.20 xmlrpclib -- XML-RPC client access
11.21 SimpleXMLRPCServer -- Basic XML-RPC server
11.22 asyncore -- Asynchronous socket handler
12. Internet Data Handling
12.1 formatter -- Generic output formatting
12.2 email -- An email and MIME handling package
- 12.2.1 Representing an email message
- 12.2.2 Parsing email messages
- 12.2.3 Generating MIME documents
- 12.2.4 Creating email and MIME objects from scratch
- 12.2.5 Internationalized headers
- 12.2.6 Representing character sets
- 12.2.7 Encoders
- 12.2.8 Exception classes
- 12.2.9 Miscellaneous utilities
- 12.2.10 Iterators
- 12.2.11 Differences from email v1 (up to Python 2.2.1)
- 12.2.12 Differences from mimelib
- 12.2.13 Examples
- 12.3 mailcap -- Mailcap file handling.
12.4 mailbox -- Read various mailbox formats
12.5 mhlib -- Access to MH mailboxes
12.6 mimetools -- Tools for parsing MIME messages
12.7 mimetypes -- Map filenames to MIME types
12.8 MimeWriter -- Generic MIME file writer
- 12.9 mimify -- MIME processing of mail messages
12.10 multifile -- Support for files containing distinct parts
12.11 rfc822 -- Parse RFC 2822 mail headers
- 12.12 base64 -- Encode and decode MIME base64 data
- 12.13 binascii -- Convert between binary and ASCII
12.14 binhex -- Encode and decode binhex4 files
- 12.15 quopri -- Encode and decode MIME quoted-printable data
- 12.16 uu -- Encode and decode uuencode files
12.17 xdrlib -- Encode and decode XDR data
12.18 netrc -- netrc file processing
- 12.19 robotparser -- Parser for robots.txt
13. Structured Markup Processing Tools
13.1 HTMLParser -- Simple HTML and XHTML parser
- 13.2 sgmllib -- Simple SGML parser
13.3 htmllib -- A parser for HTML documents
- 13.4 htmlentitydefs -- Definitions of HTML general entities
13.5 xml.parsers.expat -- Fast XML parsing using Expat
13.6 xml.dom -- The Document Object Model API
13.7 xml.dom.minidom -- Lightweight DOM implementation
13.8 xml.dom.pulldom -- Support for building partial DOM trees
13.9 xml.sax -- Support for SAX2 parsers
13.10 xml.sax.handler -- Base classes for SAX handlers
- 13.11 xml.sax.saxutils -- SAX Utilities
13.12 xml.sax.xmlreader -- Interface for XML parsers
13.13 xmllib -- A parser for XML documents
14. Multimedia Services
- 14.1 audioop -- Manipulate raw audio data
- 14.2 imageop -- Manipulate raw image data
- 14.3 aifc -- Read and write AIFF and AIFC files
14.4 sunau -- Read and write Sun AU files
14.5 wave -- Read and write WAV files
- 14.6 chunk -- Read IFF chunked data
- 14.7 colorsys -- Conversions between color systems
- 14.8 rgbimg -- Read and write ``SGI RGB'' files
- 14.9 imghdr -- Determine the type of an image
- 14.10 sndhdr -- Determine type of sound file
15. Cryptographic Services
16. Graphical User Interfaces with Tk
17. Restricted Execution
18. Python Language Services
18.1 parser -- Access Python parse trees
- 18.2 symbol -- Constants used with Python parse trees
- 18.3 token -- Constants used with Python parse trees
- 18.4 keyword -- Testing for Python keywords
- 18.5 tokenize -- Tokenizer for Python source
- 18.6 tabnanny -- Detection of ambiguous indentation
18.7 pyclbr -- Python class browser support
- 18.8 py_compile -- Compile Python source files
- 18.9 compileall -- Byte-compile Python libraries
18.10 dis -- Disassembler for Python byte code
- 18.11 distutils -- Building and installing Python modules
19. Python compiler package
20. SGI IRIX Specific Services
20.1 al -- Audio functions on the SGI
- 20.2 AL -- Constants used with the al module
20.3 cd -- CD-ROM access on SGI systems
20.4 fl -- FORMS library for graphical user interfaces
- 20.5 FL -- Constants used with the fl module
- 20.6 flp -- Functions for loading stored FORMS designs
- 20.7 fm -- Font Manager interface
- 20.8 gl -- Graphics Library interface
- 20.9 DEVICE -- Constants used with the gl module
- 20.10 GL -- Constants used with the gl module
- 20.11 imgfile -- Support for SGI imglib files
- 20.12 jpeg -- Read and write JPEG files
21. SunOS Specific Services
22. 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. Defining New Object Types
- 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__
- __main__
- _winreg (Windows)
- aepack (Mac)
- aetypes (Mac)
- aifc
- AL (IRIX)
- al (IRIX)
- anydbm
- applesingle (Mac)
- array
- asyncore
- atexit
- audioop
- base64
- BaseHTTPServer
- Bastion
- binascii
- binhex
- bisect
- bsddb (Unix, Windows)
- buildtools (Mac)
- calendar
- Carbon.AE (Mac)
- Carbon.App (Mac)
- Carbon.CF (Mac)
- Carbon.Cm (Mac)
- Carbon.Ctl (Mac)
- Carbon.Dlg (Mac)
- Carbon.Evt (Mac)
- Carbon.Fm (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
- ColorPicker (Mac)
- colorsys
- commands (Unix)
- compileall
- compiler
- compiler.ast
- compiler.visitor
- ConfigParser
- Cookie
- copy
- copy_reg
- cPickle
- crypt (Unix)
- cStringIO
- ctb (Mac)
- curses
- curses.ascii
- curses.panel
- curses.textpad
- curses.wrapper
- dbhash (Unix, Windows)
- dbm (Unix)
- DEVICE (IRIX)
- difflib
- dircache
- dis
- distutils
- dl (Unix)
- doctest
- dumbdbm
- EasyDialogs (Mac)
- email.Charset
- email.Encoders
- email.Errors
- email.Generator
- email.Header
- email.Iterators
- email.Message
- email.Parser
- email.Utils
- errno
- exceptions
- fcntl (Unix)
- filecmp
- fileinput
- findertools (Mac)
- FL (IRIX)
- fl (IRIX)
- flp (IRIX)
- fm (IRIX)
- fnmatch
- formatter
- fpectl (Unix)
- fpformat
- FrameWork (Mac)
- ftplib
- gc
- gdbm (Unix)
- getopt
- getpass
- gettext
- GL (IRIX)
- gl (IRIX)
- glob
- gopherlib
- grp (Unix)
- gzip
- hmac
- htmlentitydefs
- htmllib
- HTMLParser
- httplib
- ic (Mac)
- icopen (Mac)
- imageop
- imaplib
- imgfile (IRIX)
- imghdr
- imp
- inspect
- jpeg (IRIX)
- keyword
- linecache
- locale
- mac (Mac)
- macerrors (Mac)
- macfs (Mac)
- macfsn (Mac)
- MacOS (Mac)
- macostools (Mac)
- macpath
- macresource (Mac)
- macspeech (Mac)
- mactty (Mac)
- mailbox
- mailcap
- marshal
- math
- md5
- mhlib
- mimetools
- mimetypes
- MimeWriter
- mimify
- MiniAEFrame (Mac)
- mkcwproject (Mac)
- mmap
- mpz
- msvcrt (Windows)
- multifile
- mutex
- Nac (Mac)
- netrc
- new
- nis (UNIX)
- nntplib
- nsremote (Mac)
- operator
- os
- os.path
- parser
- pdb
- pickle
- pipes (Unix)
- PixMapWrapper (Mac)
- popen2 (Unix, Windows)
- poplib
- posix (Unix)
- posixfile (Unix)
- pprint
- preferences (Mac)
- profile
- pstats
- pty (IRIX, Linux)
- pwd (Unix)
- py_compile
- py_resource (Mac)
- pyclbr
- pydoc
- pythonprefs (Mac)
- Queue
- quietconsole (Mac)
- quopri
- random
- re
- readline (Unix)
- repr
- resource (Unix)
- rexec
- rfc822
- rgbimg
- rlcompleter (Unix)
- robotparser
- rotor
- sched
- ScrolledText (Tk)
- select
- sgmllib
- sha
- shelve
- shlex
- shutil
- signal
- SimpleHTTPServer
- SimpleXMLRPCServer
- site
- smtplib
- sndhdr
- socket
- SocketServer
- stat
- statcache
- statvfs
- string
- StringIO
- struct
- sunau
- SUNAUDIODEV (SunOS)
- sunaudiodev (SunOS)
- symbol
- sys
- syslog (Unix)
- tabnanny
- telnetlib
- tempfile
- TERMIOS (Unix)
- termios (Unix)
- thread
- threading
- time
- Tix
- Tkinter
- token
- tokenize
- traceback
- tty (Unix)
- turtle (Tk)
- types
- unicodedata
- unittest
- urllib
- urllib2
- urlparse
- user
- UserDict
- UserList
- UserString
- uu
- videoreader (Mac)
- W (Mac)
- warnings
- waste (Mac)
- wave
- weakref
- webbrowser
- whichdb
- whrandom
- winsound (Windows)
- xdrlib
- xml.dom
- xml.dom.minidom
- xml.dom.pulldom
- xml.parsers.expat
- xml.sax
- xml.sax.handler
- xml.sax.saxutils
- xml.sax.xmlreader
- xmllib
- xmlrpclib
- xreadlines
- zipfile
- zlib