I have pickled objects to a file in append mode but it only reads a single object. Here's the code. I don't know what I am doing wrong.
with open('notes.pkl', 'ab') as fileObject: #append
pickle.dump(obj, fileObject, pickle.HIGHEST_PROTOCOL)
with open('notes.pkl', 'rb') as input: #read
obj= pickle.load(input)
//perform tasks for each obj unpickled from the file
You need to call
pickle.load
repeatedly until you hit end-of-file.