Once instantiated, hash, btree and record objects support the following methods:
) |
) |
key) |
1
if the DB file contains the argument as a key.
key) |
) |
) |
) |
) |
) |
Example:
>>> import bsddb >>> db = bsddb.btopen('/tmp/spam.db', 'c') >>> for i in range(10): db['%d'%i] = '%d'% (i*i) ... >>> db['3'] '9' >>> db.keys() ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] >>> db.first() ('0', '0') >>> db.next() ('1', '1') >>> db.last() ('9', '81') >>> db.set_location('2') ('2', '4') >>> db.previous() ('1', '1') >>> db.sync() 0