blob: 6e7256747d3226398f6289041d8e9dc4cf544ab4 [file] [log] [blame]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001\section{Built-in Module \sectcode{dbm}}
2\bimodindex{dbm}
3
4Dbm provides python programs with an interface to the unix \code{ndbm}
5database library. Dbm objects are of the mapping type, so they can be
6handled just like objects of the built-in \dfn{dictionary} type,
7except that keys and values are always strings, and printing a dbm
8object doesn't print the keys and values.
9
10The module defines the following constant and functions:
11
12\renewcommand{\indexsubitem}{(in module dbm)}
13\begin{excdesc}{error}
14Raised on dbm-specific errors, such as I/O errors. \code{KeyError} is
15raised for general mapping errors like specifying an incorrect key.
16\end{excdesc}
17
18\begin{funcdesc}{open}{filename\, rwmode\, filemode}
19Open a dbm database and return a mapping object. \var{filename} is
20the name of the database file (without the \file{.dir} or \file{.pag}
21extensions), \var{rwmode} is \code{'r'}, \code{'w'} or \code{'rw'} as for
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000022\code{open}, and \var{filemode} is the \UNIX{} mode of the file, used only
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000023when the database has to be created.
24\end{funcdesc}