Loading

json使用

# 加载数据成字典(读)
with open(annotations_file, "r") as fa:
    annotations = json.load(fa)
# 上载数据成序列(写)
with open("annotation/train_annotation.json", 'w') as fp:
    json.dump(annotations, fp, indent=4, separators=(',', ': '))
posted @ 2021-05-28 10:58  Guang'Jun  阅读(36)  评论(0编辑  收藏  举报