<--------JSON file--------->
{
"DCN": {
"FileName": "at0101.07422",
"Variable": "Temperature",
"Highest_temp": "Maximum temperature",
"Lowest_temp": "Lowest temperature"
},
"DMD": {
"FileName": "bp0101.07422",
"Variable": "Air Pressure",
"Highest_pre": "Maximum air pressure",
"Lowest_pre": "The most low pressure"
},
"DMY": {
"FileName": "hu0101.07422",
"Variable": "Relative humidity",
"Highest_h": "Maximum relative humidity",
"Lowest_h": "Minimum relative humidity"
}
<------load JSON file reads the specified data--------->
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"]
Reading JSON-specified data from the load JSON file (based on Python 3.6)