Related to Shelve Module

tarun tarundevnani at
Mon Apr 28 07:08:31 CEST 2008

Hi All,
I want to store the class instance object variables persistenlty in one file
so that other file can also access for some filtering. I tired doing this
using the shelve module.

class A:

import shelve
filename = 'test.db'
d =

a = A()
print a
d['1'] = a

print d['1']

<__main__.A instance at 0x018B56C0>
<__main__.A instance at 0x018B5760>

I expect both the print statements to return the same value, The second
print statement just reads the dictonary, but still the adress (0x..) is
different from the first print statement. Can anyone tell me why. Also let
me know if you the way of getting same value both the times.

Quick help will be appreciated.

Thanks & Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list