February 2006
Intermediate to advanced
648 pages
14h 53m
English
The gdbm module provides an interface to the GNU DBM library.
open(filename [, flag=’r’ [, mode]])Opens a gdbm database with filename filename. Appending ‘f’ to the flag opens the database in fast mode. In this mode, altered data is not automatically written to disk after every change, resulting in better performance. If this flag is used, the sync() method should be used to force unwritten data to be written to disk on program termination.
A gdbm object, d, behaves like a dictionary, as described in the section “Introduction” earlier in this chapter, but it also supports the following methods:
| Method | Description |
|---|---|
| d.firstkey() | Returns the starting key in the database. |
| d.nextkey(key) | Returns the key that follows key in a traversal of the database. ... |