UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 11126: illegal multibyte sequence


python运行出现报错如图:

 


在打开文件时设置编码格式设置对应的编码格式,如:加上encoding="utf-8"
解决方法:

 

with open(self.file_path,encoding="utf-8") as fp:
  data = json.load(fp)
  return data

 



posted @ 2019-11-15 14:08  CesareCheung  阅读(230)  评论(0编辑  收藏  举报