How to solve an EOF error when reading a binary file

后端 未结 2 667
耶瑟儿~
耶瑟儿~ 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:33

    you need to catch EOFError in your loop…

    You can't read forever from a file that does not contain infinite data, so you need to put a way for the loop to stop.

    Also, there is absolutely no need to have those loops, you can directly store the list, and it will just load the list.

提交回复
热议问题