Binary File
Binary File
• Binary Files: These are files that store data in binary format. They are
used for storing non-text data such as images, audio, video, and other
multimedia. The advantage of binary files is that they are faster and
more efficient for storing complex data structures.
• Pickle Module: The pickle module in Python is used for
serializing and deserializing Python objects. Serialization
is the process of converting a Python object into a byte
stream, and deserialization is the process of converting
a byte stream back into a Python object.
Operations on Binary Files
• file = open("file_name", "mode")
Output
Write the list in a binary file and
Read the list
List
Using nested list, store multiple
employee records in a binary file
demo1.dat
Reads the employee records from the binary file demo1.dat and prints them
on the screen
output
Search the record of particular
employee
Details of employee 1
Update the employee salary