Python Pickle throwing EOFError -


already_done = ['lol', 'lol2'] already_done = pickle.load( open( "save.p", "rb" ) ) 

that little snippet of code throws eoferror pickle, no matter if save.p exists or not. suggestions?

i not why expect code snippet work, it's failing because you're not understanding how pickle works. way of example:

>>> s = (1,2,3) >>> pickle.dump(s, open('save.p', 'wb')) >>> s2 = pickle.load(open('save.p', 'b')) >>> s2 (1, 2, 3) 

you have write out using pickle module before can reload it.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -