Posted by admin on


Some notes on Python Pickle. See below/overleaf.
It reminds me of tape files, seems to be only open in read or write mode.

dictfile = open('bookmarks.pickle','rb')
D = {};                     # the input dictionary
D = pickle.load(dictfile) ; # loads a dictionary
dictfile.close();           # so the db can be opened for writing

This code works, you seem to need to close it before it permits you to open the pickle file in write mode.

del D[duff]
dictfile = open('bookmarks.pickle','wb')

In all the cases above, there is room for substitution, but this works.
I use the statement import pickle.

Comment ( 1 )

  1. delicious linkrolls |
    […] links are held in a pickle database, which could easily be converted to XML or JSON. I have code to delete a record on the […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.