python \uxxxx转中文,Python列表中的字典 \uxxxx转中文,


import
json a = [{u'mobile': u'8973', u'userName': u'\u738b\u738d', u'idCard': u'110222196308253111', u'roleFlag': 7}] print json.dumps(a).decode("unicode_escape")

输出结果是:

[{"mobile": "8973", "userName": "王玍", "idCard": "110222196308253111", "roleFlag": 7}]

 

例子二:

aa = u'\u738b\u738d'
print json.dumps(aa).decode("unicode_escape")

输出结果:

"王玍"

 

posted @ 2017-04-07 01:34  淋哥  阅读(1664)  评论(0编辑  收藏  举报