The Standard Python Library: New Modules in Python 2.2
[book home] [python 2.1] [python 2.2] [python 2.3] [python 2.4] [python 2.5]

- cgitb
CGI wrapper. This module traps exceptions in the CGI script, and generates extended traceback messages in HTML.
import cgitb, cgi cgitb.enable()- compiler (package)
The compiler package is a implementation of CPython’s compiler in 100% Python. The compiler package reads Python source code, and builds an object structure representing the abstract syntax tree. This structure can be manipulated, and compiled into CPython byte code.
- compiler.ast
- compiler.consts
- compiler.future
- compiler.misc
- compiler.pyassem
- compiler.pycodegen
- compiler.symbols
- compiler.syntax
- compiler.transformer
- compiler.visitor
- email (package)
Tools for manipulation of all sorts of email messages.
- email.base64MIME
- email.Charset
- email.Encoders
- email.Errors
- email.Generator
- email.Header
- email.Iterators
- email.Message
- email.MIMEAudio
- email.MIMEBase
- email.MIMEImage
- email.MIMEMessage
- email.MIMEMultipart
- email.MIMENonMultipart
- email.MIMEText
- email.Parser
- email.quopriMIME
- email.Utils
- encodings.base64_codec
BASE64 codec. Let’s you use the encode and decode string methods, instead of importing the base64 module.
encoded_data = data.encode("base64") decoded_data = encoded_data.decode("base64")
- encodings.cp1140
CP 1140 (EBCDIC 8-bot Western Europe, with Euro sign) codec. This codec is used to convert to and from Unicode strings.
- encodings.hex_codec
HEX codec.
encoded_data = data.encode("hex") decoded_data = encoded_data.decode("hex")
- encodings.quopri_codec
Quoted printable codec.
encoded_data = data.encode("quopri") decoded_data = encoded_data.decode("quopri")
- encodings.rot_13
ROT-13 codec.
- encodings.utf_7
UTF-7 codec for Unicode.
- encodings.uu_codec
UU codec.
encoded_data = data.encode("uu") decoded_data = encoded_data.decode("uu")
- encodings.zlib_codec
ZIP codec. Let’s you use the encode and decode string methods to compress and decompress data, instead of importing the zlib module (but note that the module lets you set more parameters, especially when compressing data).
compressed_data = data.encode("zlib") decompressed_data = compressed_data.decode("zlib")
- hmac
Calculate HMAC signatures (Keyed-Hashing for Message Authentication, RFC 2104)
import hmac h = hmac.new(key, text) h.update(moretext) print h.hexdigest()
- hotshot (package)
Tools to measure where a Python program spends must of its time (profiling).
- hotshot.log
- hotshot.stats
- HTMLParser
An improved HTML parser. Can be used to replace sgmllib, in many cases.
- markupbase
Common support code for HTMLParser and sgmllib.
- SimpleXMLRPCServer
Tools to build XML-RPC servers. Also see xmlrpclib.
- this
import this # enough said
- xmlrpclib
XML-RPC client library. Also contains tools to marshal and unmarshal XML-RPC requests.
import xmlrpclib server = xmlrpclib.ServerProxy("http://effbot.org/rpc/echo.cgi") result = server.method("hello")
