解决UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xae in position 2638: illegal multibyte sequence
问题描述
python读取json文件时报错:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xae in position 2638: illegal multibyte sequence
import json
f = open('channelManifest.json')
obj = f.read()
result = json.loads(obj)
print(result)
import json
with open('xxx.txt', 'rb') as f:
data = json.load(f)
print(data)