How to solve an EOF error when reading a binary file

后端 未结 2 666
耶瑟儿~
耶瑟儿~ 2021-01-22 03:39
class CarRecord:                    # declaring a class without other methods
  def init (self):                # constructor
    self .VehicleID = \"\"
    self.Registr         


        
2条回答
  •  无人及你
    2021-01-22 04:24

    what about this?

    while True:  # check for end of file
        try:
            Car.append(pickle.load(CarFile))  # append record from file to end of l i st
        except EOFError:
            print('EOF!!!')
            break
    

提交回复
热议问题