File: class/Extras/Code/people/updatedb.py

import shelve
db = shelve.open('persondb')

print len(db), db.keys()
for key in db:
    print key, '=>', db[key]

bob = db['bob']
print bob.name, bob.lastName(), bob.pay

sue = db['sue']
sue.giveRaise(0.10)
db['sue'] = sue
db.close()



[Home page] Books Code Blog Python Author Train Find ©M.Lutz