Computer Science
Which of the following Python modules is imported to store and retrieve objects using the process of serialization and deserialization ?
- csv
- binary
- math
- pickle
Answer
pickle
Reason — The pickle module in Python is imported to store and retrieve objects using the process of serialization and deserialization. It allows us to convert Python objects into a byte stream for storage or transmission (serialization) and to convert a byte stream into Python objects (deserialization). This process is commonly referred to as pickling and unpickling. The pickle module provides functions like dump() and load() for serialization and deserialization, respectively.
Related Questions
How is file open() function different from close() function?
Write statements to open a binary file C:\Myfiles\Text1.txt in read and write mode by specifying file path in two different formats.
Which of the following function is used with the csv module in Python to read the contents of a csv file into an object ?
- readrow()
- readrows()
- reader()
- load()
When a file is opened for output in write mode, what happens when
(i) the mentioned file does not exist
(ii) the mentioned file does exist ?