0
点赞
收藏
分享

微信扫一扫

在python中加载json文件

微言记 2023-03-25 阅读 48


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 条评论