Python 2.7.9 Demo - JSON的编码、解码

#coding=utf-8
#!/usr/bin/python
import json; dict = {};
dict['name'] = 'nick';
dict['say'] = 'hello world...';
dict['age'] = ''; dict_json = repr(dict);
print dict_json; dict_json_2 = json.dumps(dict); print dict_json_2;
#coding=utf-8
#!/usr/bin/python
import json; json_value = '{"access_token":"This is access token sample.","expires_in":7200}'; decoded = json.loads(json_value);
print decoded;
print decoded['access_token'];
print decoded['expires_in'];
上一篇:二分法 codevs 1432 总数统计


下一篇:Windows下安装tomcat