best way to store dbm records?
Michael B. Allen
mballen at NOSPAM_erols.com
Sat Oct 7 15:43:03 EDT 2000
Hi!
I was wondering what the best/simplest way to store dbm records is? This is
how I am currently adding records:
# create dbm record
p = '102'
s = getfield(msg, 'from')
a = getfield(msg, 'authors')
v = getfield(msg, 'version')
d = getfield(msg, 'description')
x = getfield(msg, 'fixes')
o = getfield(msg, 'obsoletes')
r = getfield(msg, 'requires')
f = getfield(msg, 'flags')
dbmrecord = (a,v,d,x,o,r,f)
db[p] = `dbmrecord`
This is what the dbm record looks like as a string(with the key '102' before
it):
102 ('', 'ds-0.1', 'Would you like to send a Broadcast Email Advertisement
to\012 1,000,000 PEOPLE DAILY (30,000,000 People a Month) for FREE?', '',
'', '', '')
[don't worry, I'm not sending bulk e-mail. I'm just processing e-mail and
happen to have plenty of junk to test it with]
Then, to get a record out I eval it like this:
dbmrecord = eval(db[key])
(a,v,d,x,o,r,f) = dbmrecord
Will this work reliably or is there a better way?
Thanks,
Mike
More information about the Python-list
mailing list