• 通过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"]
  • 相关阅读:
    Spring JDBC
    获取JNDI数据源
    subset II
    hadoop-0.20.2安装配置
    leetcode5:subsets问题
    leetcode4:Permutation
    leetCode3
    leetcode2:线性表
    leetcode1:线性表
    使用C++11 开发一个半同步半异步线程池
  • 原文地址:https://www.cnblogs.com/setname/p/8676450.html
Copyright © 2020-2023  润新知