gdbm

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:

MethodDescription
d.firstkey()Returns the starting key in the database.
d.nextkey(key)Returns the key that follows key in a traversal of the database. ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.