Python:读取 Json 文件,并用一个 dict 保存

import json
if __name__ == '__main__':
    with open("F:/xxx.json", 'r', encoding='UTF-8') as f:
        load_dict = json.load(f)

# 若json文件内容为
# {
#     "type": "aaa",
#     "features":[bbb,ccc],
#     "system": "ddd",
# }

# 则其中
# “type”、“features“、”ststem“ 存储为 dict 中的 key
# “aaa”、[bbb、ccc]、”ddd“ 存储为 dict 中上述 key 对应的 value

 

posted @ 2022-08-12 17:47  xiaoxinZard  阅读(199)  评论(0)    收藏  举报