Deleting keys from shelve

O

Olaf Meding

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top