python將dict中的unicode打印成中文
阿新 • • 發佈:2017-08-10
輸出 dumps address point tle python json port ont
python將dict中的unicode打印成中文
import json
a = {u‘content‘:
{u‘address_detail‘: {u‘province‘: u‘\u5409\u6797\u7701‘, u‘city‘:
u‘\u957f\u6625\u5e02‘, u‘street_number‘: u‘‘, u‘district‘: u‘‘,
u‘street‘: u‘‘, u‘city_code‘: 53}, u‘point‘: {u‘y‘: u‘43.89833761‘,
u‘x‘: u‘125.31364243‘}, u‘address‘:
u‘\u5409\u6797\u7701\u957f\u6625\u5e02‘}, u‘status‘: 0, u‘address‘:
u‘CN|\u5409\u6797|\u957f\u6625|None|CERNET|0|0‘}
print json.dumps(a).decode(‘unicode-escape‘)
輸出:
{"content": {"address_detail": {"province": "吉林省", "city":
"長春市", "street_number": "", "district": "", "street": "", "city_code":
53}, "address": "吉林省長春市", "point": {"y": "43.89833761", "x":
"125.31364243"}}, "status": 0, "address": "CN|吉林|長春|None|CERNET|0|0"}
python將dict中的unicode打印成中文