r+ (appending) and pickle do not mix!
Published: Wednesday, Dec 26, 2007 Last modified: Wednesday, Mar 29, 2023
If you open a file with r+:
and then load from it:
dict = pickle.load(f)
and then write to it:
You will have two pickles in that file, and only the last pickle will have what you want. Hence appending and pickling DO NOT MIX !!