Deleting keys from shelve
Olaf Meding
OlafMeding at compuserve.com
Wed Nov 24 14:05:27 EST 2004
Why does a shelve file never get smaller?
I noticed that the shelve file (db.txt, see below) does not change
(get smaller) when deleting a key. The key is deleted but the file
size does not change. I expected the db.txt file to get smaller.
def delete():
s = shelve.open('db.txt')
del s['test3']
s.close()
I am using Python 2.2.1 on MS Windows. Thanks so much for your help.
Olaf
More information about the Python-list
mailing list