How to install pickle in python

(*-*)浩
Release: 2019-06-25 14:40:05
Original
10044 people have browsed it

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.

How to install pickle in python

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)
Copy after login

The deserialization operation includes:

pickle.load()
Unpickler(file).load()
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template