Binary Files - CBSE Class 12 Computer Science Notes, Diagrams and Solved Questions

Store Python lists and dictionaries in binary files with pickle: the rb, rb+, wb, wb+, ab and ab+ modes, dump and load, and creating, reading, searching, appending and updating records.

In this chapter

  • What binary files are, and pickling and unpickling
  • The binary modes rb, rb+, wb, wb+, ab, ab+
  • Creating a file of records with pickle.dump()
  • Reading every record with pickle.load() and EOFError
  • Searching records with a condition and a found flag
  • Appending records with ab mode
  • Updating and deleting records by rewriting the file