MOOC (7) - case dependent, the configuration file is read a plurality of interfaces json requests - read json file (12)

Read json data, the key here is to get

If the request dictionary data is long, then the embodiment can use the data, the requested data represented by a keyword, the actual presence of the requested data file json, json key as the keyword, so that the data associated with the

# -*- coding: utf-8 -*-
# @Time : 2020/2/12 14:55
# @File : learn_jaon_12.py
# @Author: Hero Liu
# 从json读取数据
import json

with open("../data/data.json") as fp:
    data = json.load(fp)
print(data["login"])

 

Guess you like

Origin www.cnblogs.com/come202011/p/12315022.html