import pickle class person: def __init__(self,name,age): self.name=name self.age=age def __str__(self): return f"{self.name} is {self.age} years old\n" def read_to_binary_file_list(people_list,filename): with open(filename,"ab") as file: for person in people_list: pickle.dump(person,file) def write_to_binary_file(person,filename): with open(filename,"ab") as file: pickle.dump(person,file) people=[person("Ali Turan",45),person("Ali Turan2",33),person("Ali Turan3",73)] write_to_binary_file(people,"data/binary1.bin") for person in people: write_to_binary_file(people,"data/binary2.bin")