Pickle's simple to use

Pickle the Chinese word meaning "kimchi, pickles, vegetable sauce" means, Pickle is a Python package, the main function of the data serialization and de-serialization. So what is called serialization and de-serialization of it?

The sequence of the process is to process data into a binary data stream. The deserialization process is to serialize the data back into the original process data. Well, why engage in such a process? Play with?

First, the binary data are stored in a computer, so that the sequence is complete will facilitate storage, secondly, communications are transmitted binary data, the communication would be beneficial.

The basic serialization syntax:

pickle.dump (obj, file, protocol = None, *, tix_imports = True): the obj object serialization to a file stored in the file.

Pickle (file, protocol) .dump (obj): the obj object serialization to a file stored in the file.

Deserialize basic syntax:

pickle.load (file, *, fix_imports = True, encoding = "ASCII" .errors = "strict"): the sequence of the target taken out from a file in the file.

Unpickle (file, *, fix_imports = True, encoding = "ASCII" .errors = "strict") load ():. The serialized objects removed from the file file.

Thank the blogger's blog: https: //www.cnblogs.com/fmgao-technology/p/9078918.html and interpretation provided by the author: https: //www.jb51.net/article/135407.htm

Guess you like

Origin www.cnblogs.com/JadenFK3326/p/11725147.html