Additional File-Processing Modules
There are several other chapters of the Python Library Reference
that cover with even more file formats. We'll identify them briefly
here.
Chapter 7 - Internet Data Handling. Reading and processing files of Internet data types is very
common. Internet data types have formal definitions governed by the
internet standards, called Requests for Comment (RFC's). The following
modules are for handling Internet data structures. These modules and
the related standards are beyond the scope of this book.
-
email
-
Helps you handle email MIME attachments.
-
mailcap
-
Mailcap file handling.
-
mailbox
-
Read various mailbox formats.
-
mhlib
-
Manipulate MH mailboxes from Python.
-
mimetools
-
Tools for parsing MIME-style message bodies.
-
mimetypes
-
Mapping of filename extensions to MIME types.
-
MimeWriter
-
Generic MIME file writer.
-
mimify
-
Mimification and unmimification of mail messages.
-
multifile
-
Support for reading files which contain distinct parts, such
as some MIME data.
-
rfc822
-
Parse RFC 822 style mail headers.
-
base64
-
Encode and decode files using the MIME base64 data.
-
binhex
-
Encode and decode files in binhex4 format.
-
binascii
-
Tools for converting between binary and various
ASCII-encoded binary representations.
-
quopri
-
Encode and decode files using the MIME quoted-printable
encoding.
-
uu
-
Encode and decode files in uuencode format.
Chapter 13 - Data Persistence. Many Python programs will also deal with Python objects that are
exported from memory to external files or retrieved from files to
memory. Since an external file is more persistent than the volatile
working memory of a computer, this process makes an object persistent
or retrieves a persistent object. One mechanism for creating a
persistent object is called serialization, and is supported by several
modules, which are beyond the scope of this book.
-
pickle
-
Convert Python objects to streams of bytes and back.
-
cPickle
-
Faster version of pickle, but not subclassable.
-
copy_reg
-
Register pickle support functions.
-
shelve
-
Python object persistence.
-
marshal
-
Convert Python objects to streams of bytes and back (with
different constraints).
More complex file structures can be processed using the standard
modules available with Python. The widely-used DBM database manager is
available, plus additional modules are available on the web to provide
ODBC access or to connect to a platform-specific database access
routine. The following Python modules deal with these kinds of files.
These modules are beyond the scope of this book.
-
anydbm
-
Generic interface to DBM-style database modules.
-
whichdb
-
Guess which DBM-style module created a given
database.
-
dbm
-
The standard database interface, based on the ndbm
library.
-
gdbm
-
GNU's reinterpretation of dbm.
-
dbhash
-
DBM-style interface to the BSD database library.
-
bsddb
-
Interface to Berkeley DB database library
-
dumbdbm
-
Portable implementation of the simple DBM interface.
-
sqlite3
-
A very pleasant, easy-to-use relational database
(RDBMS).