Python字符乱码

content = b'{"log_id": 5507183146687669657, "words_result_num": 2, "words_result": [{"location": {"width": 154, "top": 102, "left": 216, "height": 53}, "words": "\xe5\x8f\xa5\xe7\x9c\x9f\xe8\xa9\xb1"}, {"location": {"width": 198, "top": 148, "left": 168, "height": 20}, "words": "\xe8\x83\xbd\xe6\xaf\x94\xe6\x95\xb4\xe5\x80\x8b\xe4\xb8\x96\xe7\x95\x8c\xe7\x9a\x84\xe5\x88\x86\xe9\x87\x8f\xe9\x82\x84\xe9\x87\x8d"}]}'

 

解决方法:

content = content.decode('UTF-8')

或者

content = bytes.decode(content)

 

posted @ 2018-05-06 09:21  Python研究者  阅读(426)  评论(0编辑  收藏  举报