I am an beginner of python and I am doing an exercise to create a address-book program. And now I have some problems.
The information is stored by 'pickle.dump'. I try to insert 2 information to the file 2 times
f = open(contacts, 'wb')
pickle.dump(ab, f)
f.close()
f = open(contacts, 'ab')
pickle.dump(ab, f)
f.close()
but I can't 'load' these information at once and I can read these information in for loop.
f = open(file, 'rb')
for i in range(2):
stroed = pickle.load(f)
print(stroed)
I don't know how to use while loop to read all information and end while loop at the end of the file.
Can you help me, please?