PICKLE LIBRARY :

To handle data while creating the project, we can use a database, which is used for storing and reading data types, serializing and deserializing, and has two methods. Dump() (serialize) stores data in a file after serialization, and Load() (deserialize) reads serialized data after importing lib import pickle.

There are two modes. wb(write binary)(data write) and rb(data read) which is used in this library converts into txt format

list = {1: "6", 2: "2", 3: "f"} 
 # created a dictionary and two arguments are passed in file, object and name of file where data can be passed
file = open("text.txt", "wb")  # created a var and opened a txt file in wb mode 
# (data write) where we can write or convert it into txt file, "text.txt" is the name
# of txt file where you want to dump data which is already created or will be created
pickle.dump(list, file)  # we dump list in file in which text.txt file is there ,
# so, it we serialize and will send data to text.txt file
file.close()  # now we will close the file, it will be stored in binary

Now read

file = open("text.txt", "rb")  # open the file in which text.txt is stored and read binary
list = pickle.load(file)  # deserialize after opening, we will load the file in list
print(list)  # and print the list