问题描述
import json
with open('StreamingHistory0.json') as json_file:
history = json.load(json_file)
@H_404_4@
但是,我不断遇到以下错误:
File "C:\Users\User\AppData\Local\Programs\Python\python38\lib\encodings\cp1252.py",line 23,in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 97181: character maps to <undefined>
@H_404_4@
解决方法
很可能是编码错误。试试
with open('StreamingHistory0.json',encoding='utf-8')