In python, the pickle class can be used to serialize python objects. cPickle provides a simpler and faster interface, as mentioned in the python document: "cPickle-A faster pickle ". CPickle can serialize any type of python object, such as list, dict, or even a class object. The so-called serialization, my superficial understanding, is to be able to completely save and completely reversible recovery. In cPickle, there are four main functions to do this. The following example is used to introduce them. 1. dump: serialize and save a python object to a local file. >>> Import cPickle >>> data = range (1000) >>> cPickle. dump (data, open ("test \ data. pkl "," wb ") the dump function needs to specify two parameters. The first is the name of the python object to be serialized, and the second is a local file. Note that, here, you need to use the open function to open a file and specify the "write" operation. 2. load: load the local file and restore the python object >>> data = cPickle. load (open ("test \ data. (pkl "," rb ") Same as dump. Here, you need to use the open function to open a local file and specify the" read "operation 3. dumps: serialize a python object and save it to a string variable. >>> Data_string = cPickle. dumps (data) 4. loads: load a python object from a string variable >>> data = cPickle. loads (data_string)