Python basis of six --JSON, pickle module

A, JSON

  Data memory <---> JSON format <---> character type <---> Save, based on the transmission network

  1. str data into the form: data_str = json.dumps (data);

  2. str dictionary data into the form data and the like: data = json.loads (data_str);

  3. Note json Format: data = '{ "name": "gangzi"}';

Two, the pickle (applied only Python, different versions of the Python may not be compatible with each other, data can be important)

  Data memory <---> Format pickle <---> bytes Type <---> Save, based on the transmission network

  1. The data bytes into the form: data_str = pickle.dumps (data);

  2. The form of the data bytes into data dictionaries: data = pickle.loads (data_str);

Guess you like

Origin www.cnblogs.com/gangzi4321/p/10930034.html