S
Shivram U
Hi,
I want to store dictionaries on disk. I had a look at a few modules
like bsddb, shelve etc. However would it be possible for me to do the
following
hash[1] = [1, 2, 3] where the key is an int and not a string
bsddb requires that both the key,value are string.
shelve does support values being object but not the keys. Is there any
module which support keys which are not strings
Also how do i use disk based hashes for multidimensional hashes such as
below
#!/usr/bin/python
dict={}
dict['key1'] = {}
dict[('key1')][('key2')] = 'value'
key1=dict['key1']
print key1['key2']
I have read of mxBeeDict but was unable to get it work properly. I am
not sure if it supports what i need as i was unable to get any
documentation about it. Is the module used widely ?
Below is how i am using the module
bdict = BeeDict('/tmp/beedict')
bdict[1] = 1
print bdict.keys()
bdict.commit()
bdict.close()
bdict1 = BeeDict('/tmp/beedict')
print bdict1.keys()
print bdict1.values()
Would it be that using disk based dictionaries once opened are as fast
as in memory dictionaries ?
Thanks in advance,
Best Regards,
Shivram U
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or (e-mail address removed) immediately
and destroy all copies of this message and any attachments.
I want to store dictionaries on disk. I had a look at a few modules
like bsddb, shelve etc. However would it be possible for me to do the
following
hash[1] = [1, 2, 3] where the key is an int and not a string
bsddb requires that both the key,value are string.
shelve does support values being object but not the keys. Is there any
module which support keys which are not strings
Also how do i use disk based hashes for multidimensional hashes such as
below
#!/usr/bin/python
dict={}
dict['key1'] = {}
dict[('key1')][('key2')] = 'value'
key1=dict['key1']
print key1['key2']
I have read of mxBeeDict but was unable to get it work properly. I am
not sure if it supports what i need as i was unable to get any
documentation about it. Is the module used widely ?
Below is how i am using the module
bdict = BeeDict('/tmp/beedict')
bdict[1] = 1
print bdict.keys()
bdict.commit()
bdict.close()
bdict1 = BeeDict('/tmp/beedict')
print bdict1.keys()
print bdict1.values()
Would it be that using disk based dictionaries once opened are as fast
as in memory dictionaries ?
Thanks in advance,
Best Regards,
Shivram U
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or (e-mail address removed) immediately
and destroy all copies of this message and any attachments.