Newbie question - deleting records from anydbm database

Dan M dan at wolf.com
Wed Dec 14 20:01:47 EST 2005


I've been Googling like a mad fiend and flipping through my hard-copy
Python books, but still haven't located the one little bit of info I need.

I've put together a simple SMTP-after-IMAP script that gets the authorized
IP info from the mail log (I know, it's not elegant but it works). All
works fine up until I go to scan the database of added IP addresses to
delete the old ones. The problem is, I don't know how to drop a record
from an anydbm database!

The database file in question is compatible with the database built using
"makemap hash imapauth < imapauth" - in fact, I'm using makemap to check
the file contents against what I'm expecting.

I'm adding records with code such as:
     db = anydbm.open(accessDbPath, "w")
     db[ipAddress] = str(time.time())

Now how can I go about deleting that record when it's too old?




More information about the Python-list mailing list