python读取一个json文件某个数据_通过load json文件读取json指定数据(基于python 3.6)...

<--------json文件--------->

{

"DCN":{

"filename":"at0101.07422",

"variable":"气温",

"Highest_temp":"最高气温",

"Lowest_temp":"最低气温"

},

"DMD":{

"filename":"bp0101.07422",

"variable":"气压",

"Highest_pre":"最高气压",

"Lowest_pre":"最低气压"

},

"DMY":{

"filename":"hu0101.07422",

"variable":"相对湿度",

"Highest_h":"最大相对湿度",

"Lowest_h":"最低相对湿度"

}

<------load json文件读取指定数据--------->

import json

import os

import datetime

import time

import linecache

# original file path

file_path = "E:/transer/git_transer/transer/filepath/"

# json_save_path

save_path = "E:/transer/git_transer/transer/format_json/"

dataJson = json.load(open('format_file.json',encoding='UTF-8'))

#气温

at = dataJson["AT"]

at_file_path = file_path + at["filename"]

at_filename =at["filename"]

at_name = at["name"]

at_max = at["air_temp_max"]

at_min = at["air_temp_min"]

at_data = at["air_temp"]

at_savename = at["save_name"]

#气压

bp = dataJson["BP"]

bp_file_path = file_path + bp["filename"]

bp_filename = bp["filename"]

bp_name = bp["name"]

bp_max = bp["surface_pressure_max"]

bp_min = bp["surface_pressure_min"]

bp_data = bp["surface_pressure"]

bp_savename = bp["save_name"]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值