使用 python 解析时的以下消息给出以下错误。消息来自json文件消息:
"Daca nu il stiti déjà, cu siguranta o sa va smulga un zambet. O portie de motivatie pentru toata lumea. :)",
错误:
Traceback (most recent call last):
File "C:\Users\X\Desktop\store_post.py", line 328, in <module>
post_l_1 =jsonToPost.return_post_list(data2)
File "C:\Users\X\Desktop\jsonToPost.py", line 20, in return_post_list
post_message = json.dumps(read_,sort_keys = True, indent =2,skipkeys=True)
File "C:\Python27\lib\json\__init__.py", line 238, in dumps
**kw).encode(obj)
File "C:\Python27\lib\json\encoder.py", line 195, in encode
return encode_basestring_ascii(o)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 18: invalid continuation byte
相关的代码片段是:
post_message = json.dumps(read_,sort_keys = True, indent =2,skipkeys=True)
post_message = json.loads(post_message)