json.dumps在默认情况下,对于非ascii字符生成的是相对应的字符编码,而非原始字符,例如:
- >>> import json
- >>> js = json.loads('{"haha": "哈哈"}')
- >>> print json.dumps(js)
- {"haha": "/u54c8/u54c8"}
解决办法很简单:
- >>> print json.dumps(js, ensure_ascii=False)
- {"haha": "哈哈"}
转自:http://blog.csdn.net/sagittar/article/details/6169605
--end