I wanted to count the number of lists in my binary file for a project that I have made, so that I can print my previously stored data but I receive an EOF error. Can you tell me why?
import pickle
F=open('binary_file_1.dat','rb')
while True:
List=pickle.load(F)
l=l+1
F.close()
print('l=',l)
Output:
Traceback (most recent call last):
File "C:\Users\Jonas\Desktop\program_x.py", line 7, in <module>List=pickle.load(F)
EOFError: Ran out of input
Open to all suggestions. Thank you, readers
count=1 F=open('binary_file_1.dat','rb') Y=F.readlines() for x in Y: z=len(x) for q in range(z-1): if x[q:q+1]==b'.': count=count+1 F.close()Thanks for your concern