美文网首页
python 读取json 文件

python 读取json 文件

作者: Mitchell520 | 来源:发表于2017-04-25 22:04 被阅读0次

/'''

#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 文件

      本文链接:https://www.haomeiwen.com/subject/xojbzttx.html