json.loads pk json.dumps
json.loads(str) 加载加载string ,把string转化成dictjson.dumps(dict) 卸货卸货成string,把dict转化成stringpythonimport jsondict_ = {1:2, 3:4, "55":"66"}#test json.dumpsprint type(dict_), dictjson_str=json.dumps
·
- 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
运行结果:
更多推荐
已为社区贡献1条内容
所有评论(0)