Reading JSON-specified data from the load JSON file (based on Python 3.6)

Source: Internet
Author: User

<--------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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.