码迷,mamicode.com
首页 > 编程语言 > 详细

Python 2.7.9 Demo - JSON的编码、解码

时间:2015-07-02 23:53:23      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:

 

#coding=utf-8
#!/usr/bin/python
import json;

dict = {};
dict[name] = nick;
dict[say] = hello world...;
dict[age] = 20;

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];

 

Python 2.7.9 Demo - JSON的编码、解码

标签:

原文地址:http://www.cnblogs.com/nick-huang/p/4617358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!