Correct option is B
The
pickle module is used to serialize (convert to a byte stream) and deserialize (convert from a byte stream) Python objects. This allows you to create and work with binary files in Python, making it ideal for creating binary files and saving Python objects in binary format.
Important Key Points:
1.
pickle Module: The pickle module allows you to serialize and deserialize Python objects, which can then be saved to binary files and retrieved later.
2.
Binary File Operations: You can write Python objects to a binary file using pickle.dump() and read them back with pickle.load().
3.
File I/O with Pickle: You can open a file in binary mode ('wb' or 'rb') and use the pickle module to write and read objects to and from that file.
Knowledge Booster:
·
Option (a): The
bin module does not exist in Python. While bin() is a built-in function used to convert numbers to binary, it is not related to file handling.
·
Option (c): There is no
binfile module in Python. This is not a valid module for handling binary files.
·
Option (d): There is no
Binary module in Python. Handling binary data is typically done using built-in modules like pickle or by using file modes such as 'rb' and 'wb'.