Skip to Content
Python: Essential Reference, Third Edition
book

Python: Essential Reference, Third Edition

by David Beazley
February 2006
Intermediate to advanced content levelIntermediate to advanced
648 pages
14h 53m
English
Sams
Content preview from Python: Essential Reference, Third Edition

dbhash

The dbhash module is used to open databases using the bsddb module, but with an interface that closely matches the interface of the other database modules.

open(
							filename
							[,flag=’r’ [,
							mode
							])

Opens a DB database and returns the database object. A database object, d, returned by open() behaves like a dictionary and also provides the following methods:

MethodDescription
d.first()Returns the first key in the database
d.last()Returns the last key in a database traversal
d.next(key)Returns the next key following key in the database
d.previous(key)Returns the item that comes before key in a forward traversal of the database
d.sync()Writes unsaved data to the disk
error

Exception raised on database errors other than KeyError. Same as bsddb.error ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python: Essential Reference

Python: Essential Reference

David M. Beazley

Publisher Resources

ISBN: 0672328623Purchase book