python 读取json 文件

/'''

#test.json

"time":"2017-04-25 "

''freq'':98

"power":-40

'''/


import json #引入json模块

file=open('text.json','r')   #text.json是我们想要读取的json文件

info=json.load(file)    

time_info=info['time'] #读取json文件中的time字段对应的值

print time_info  #打印结果为2017-04-25

你可能感兴趣的:(python 读取json 文件)