How to count several serialized objects in the list using the pickle function? Tried to count in this way:
data2 = [] with open("AllOutputMethodsObj.txt", "rb") as f: for _ in range(pickle.load(f)): data2.append(pickle.load(f)) print (str(data2)) But at the output I get an error:
for _ in range(pickle.load(f)): EOFError: Ran out of input The number of serialized objects I do not know. A file with an unknown number of serialized objects is fed to the input.