I am using the latest version of python and after searching, I can not find anything on pickles that will work for me.
I am just looking through textbooks, trying to find out about etching, and not one of the source codes that seem to work on the textbooks will work for me, I suspect this is due to outdated textbooks.
What I tried and it is the same as the following tutorials show:
import pickle
lists = [1,2,3,4,5]
pickle.dump(lists, open('log.txt', 'a+'))
which gives me the following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
pickle.dump(lists, open('log.txt', 'a+'))
TypeError: must be str, not bytes
this
>>> import pickle
>>> unpicklefile = open('log.txt', 'r')
>>> unpickledlist = [1,2,3,4,5]
>>> unpickledlist = pickle.load(unpicklefile)
gives the following error:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
unpickledlist = pickle.load(unpicklefile)
TypeError: 'str' does not support the buffer interface
Thanks for any answers and help.