$ python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import cdb
>>> print cdb.__version__
0.21
>>> c = cdb.init("f.cdb")
>>> print c.__doc__
This object represents a CDB database: a reliable, constant
database mapping strings of bytes ("keys") to strings of bytes
("data"), and designed for fast lookups.
Unlike a conventional mapping, CDBs can meaningfully store multiple
records under one key (though this feature is not often used).
A CDB object 'cdb_o' offers the following interesting attributes:
Dict-like Lookup Methods:
cdb_o[key], get(key), getnext(), getall(key)
Key-based Iteration Methods:
keys(), firstkey(), nextkey()
(Key-based iteration returns only distinct keys.)
Raw Iteration Method:
each()
("Dumping" may return the same key more than once.)
__members__:
fd - File descriptor of the underlying cdb.
name - Name of the cdb, or None if not known.
size - Size of the cdb, or None if not mmap()d.
__length__:
len(cdb_o) returns the total number of items in a cdb,
which may or may not exceed the number of distinct keys.
>>> cm = cdb.cdbmake("/tmp/o.cdb", "/tmp/o.cdb.tmp")
>>> print cm.__doc__
cdbmake objects resemble the struct cdb_make interface:
CDB Construction Methods:
add(k, v), finish()
__members__:
fd - fd of underlying CDB, or -1 if finish()ed
fn, fntmp - as from the cdb package's cdbmake utility
numentries - current number of records add()ed