1, in the production, dumps and loads only once, and to use W to the original data washed away, so as to ensure that each time is the latest. 2, the snapshot of the virtual machine is that each snapshot has a file, not all are not put together. 3. If you want to produce several serialization, generate multiple files. 4, JSON and pickle have the same method: JSON: for (different platform and multi-language) strings and Python data types for conversion pickle: For Python-specific types and Python data types between the conversion (all Python data types) JSON: module provides four functions: dumps dump loads load pickle: module provides four functions: Dumps dump loads load (1), modify in memory, read by write and read, for loop Write to file: dumps:F.write (Jsoin|pickle.dumps (info))Loadsjson| pickle.loads (F.read ())
(2), directly write files, no other method: dump:json|pickle.dump (info,f)Loaddata = Json|pickle.load (f)Note: Python2 can dump multiple times, load multiple times, 2 times are one by one corresponding Python3 can only dump multiple times, loads, load once
Module explanation----The difference between JSON and pickle modules