Simple "database" interface
===========================
The standard "database" interface, based on ndbm.
The `dbm' module provides an interface to the UNIX (`n')`dbm' library.
Dbm objects behave like mappings (dictionaries), except that keys and
values are always strings. Printing a dbm object doesn't print the
keys and values, and the `items()' and `values()' methods are not
supported.
This module can be used with the "classic" ndbm interface, the BSD DB
compatibility interface, or the GNU GDBM compatibility interface. On
UNIX, the `configure' script will attempt to locate the appropriate
header file to simplify building this module.
The module defines the following:
`error'
Raised on dbm-specific errors, such as I/O errors. `KeyError' is
raised for general mapping errors like specifying an incorrect key.
`library'
Name of the `ndbm' implementation library used.
`open(filename[, flag[, mode]])'
Open a dbm database and return a dbm object. The FILENAME
argument is the name of the database file (without the `.dir' or
`.pag' extensions; note that the BSD DB implementation of the
interface will append the extension `.db' and only create one
file).
The optional FLAG argument must be one of these values:
Value Meaning
------ -----
'r' Open existing database for
reading only (default)
'w' Open existing database for
reading and writing
'c' Open database for reading and
writing, creating it if it
doesn't exist
'n' Always create a new, empty
database, open for reading and
writing
The optional MODE argument is the UNIX mode of the file, used only
when the database has to be created. It defaults to octal `0666'.
See also:
Note:anydbm Generic interface to `dbm'-style databases. Note:gdbm Similar interface to the GNU GDBM library. Note:whichdb
Utility module used to determine the type of an existing database.