I have created a shelve file and inserted a dictionary data. Now I want to cleanup that shelve file to reuse as a clean file.
import shelve
dict = shelve.open("Sample.db")
# insert some data into sample.db
dict = { "foo" : "bar"}
#Now I want to clean entire shelve file to re-insert the data from begining.
Shelve behaves just like a dictionary, thus:
dict.clear()
Alternatively, you can always remove the file and let shelve create a new one.