在python中加载json文件

with open(file,"r") as f:
  data = json.load(f)

如果报错

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte

将with open(file) as f: 改成 with open(file, ‘r’, encoding=’utf-8′) as f

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?