berkeley db delete problem?
wweston at att.net
Mon Aug 9 18:25:07 CEST 2004
Oliver Peek wrote:
> Hi all,
> Probably my fault, I'm opening a Berkeley DB
> file, iterating through and deleting keys, well
> making an attempt. I get this error when I try
> to delete.
> Traceback (most recent call last):
> File "./db.py", line 41, in ?
> AttributeError: delete
> ---end error
> Below is a code snippet:
> import bsddb
> db = bsddb.btopen('./test.db', 'r')
> rec = db.first()
> while rec:
> key, val = rec
> rec = db.next()
> ---end code
> I have full code that opens and goes through and
> prints the key and value and opens another db
> file and inserts the key/data into that new db
> file, but I need to delete the data out of the
> master db file once it's been updated in the
> smaller ones.
> I've also tried db.delete(key) with no luck,
> db.del(), db.del(key), db[key]='', and lots of
> other silly attempts, but nothing works.
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
How bout del db[key]
More information about the Python-list