Python之字典
字典常用操作
import json
d = {"name":"zz","age":"100"}
print(type(d)) # <class 'dict'>
s = json.dumps(d) # 字典转字符串
print(s) # {"name": "zz", "age": "100"}
print(type(s)) # <class 'str'>
dic = json.loads(s) # 字符串转字典
print(dic) # {'name': 'zz', 'age': '100'}
print(type(dic)) # <class 'dict'>