Python报错:
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
实际是编码问题,需要decode为utf-8.
res = requests.get(url)
res.encoding="utf-8"
print(res.text)
for each in json.loads(res.text.encode("utf-8")):
print(each)
(Visited 71 times, 1 visits today)
本文作者为书途,转载请注明。