【441】JSON format

Ref: json -- JSON encoder and decoder

JSON(JavaScript Object Notation) can help us to see data more intuitive. Example:

import json
>>> a = {"hobbies":{"balls":"basketball, volleyball", "others":"watching movies"},"name":{"first_name":"Alex", "last_name":"Lee"}, "age":20, "height":183}
		    
>>> print(json.dumps(a, indent = 4))
		    
{
    "hobbies": {
        "balls": "basketball, volleyball",
        "others": "watching movies"
    },
    "name": {
        "first_name": "Alex",
        "last_name": "Lee"
    },
    "age": 20,
    "height": 183
}

  

原文地址:https://www.cnblogs.com/alex-bn-lee/p/11645558.html