• json.loads(str) 加载
    加载string ,把string转化成dict
  • json.dumps(dict) 卸货
    卸货成string,把dict转化成string
python
import json
dict_ = {1:2, 3:4, "55":"66"}

#test json.dumps
print type(dict_), dict
json_str=json.dumps(dict_)
print type(json_str), json_str

#test json.loads
dict_2=json.loads(json_str)
print type(dict_2), dict_2

运行结果:

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐