Home > Article > Backend Development > How to install pickle in python
pickle is a standard module of the python language. The pickle library is already included after installing python and does not need to be installed separately.
The pickle module implements basic data serialization and deserialization. (Recommended learning: Python video tutorial)
Through the serialization operation of the pickle module, we can save the object information running in the program to a file for permanent storage ;Through the deserialization operation of the pickle module, we can create the object saved by the last program from the file.
In the official introduction, the English description of the serialization operation has several words, such as "serializing", "pickling", "serialization", "marshalling" or "flattening", etc., they are all It means serialization. Correspondingly, there are many English words for deserialization operations, such as "de-serializing", "unpickling", "deserailization", etc. To avoid confusion, generally use "pickling"/"unpickling", or "serialization"/"deserailization".
The pickle module is serialized in binary form and saved to a file (the suffix of the saved file is ".pkl"), and cannot be opened directly for preview. JSON, another serialization standard module of Python, is human-readable and can be opened and viewed directly (for example, viewed in notepad).
The pickle module has two main types of interfaces, namely serialization and deserialization.
The serialization operation includes:
pickle.dump() Pickler(file, protocol).dump(obj)
The deserialization operation includes:
pickle.load() Unpickler(file).load()
For more Python related technical articles, please visit Python Tutorial column for learning!
The above is the detailed content of How to install pickle in python. For more information, please follow other related articles on the PHP Chinese website!