Python3如何解码包含\ xe字符串的json

时间:2017-11-21 03:45:11

标签: python-3.x

import json
txt = '{"fundcode":"110022","name":"\xe6\x98\x93\xe6\x96\xb9\xe8\xbe\xbe\xe6\xb6\x88\xe8\xb4\xb9\xe8\xa1\x8c\xe4\xb8\x9a",' \
      '"jzrq":"2017-11-20","dwjz":"2.3020","gsz":"2.3203","gszzl":"0.79","gztime":"2017-11-21 11:30"}'
ret = json.loads(txt)
print(ret)

错误提示如下:

  

UnicodeEncodeError:'gbk'编解码器无法对位置32中的字符'\ xe6'进行编码:非法多字节序列

0 个答案:

没有答案