【问题标题】:how do I find the temperature in the stuff written below?我如何在下面写的东西中找到温度?
【发布时间】:2018-07-06 10:36:43
【问题描述】:

我如何从这个 openweathermap api 中找到以度 (F) 为单位的温度:

{ coord: { lon: -73.36, lat: 40.81 }, weather: [ { id: 800, main: "Clear", description: "clear sky", icon: "01n" } ], base: "stations", main: { temp: 272.69, pressure: 1039, humidity: 63, temp_min: 270.15, temp_max: 275.15 }, visibility: 16093, wind: { speed: 2.6, deg: 190 }, clouds: { all: 1 }, dt: 1517014560, sys: { type: 1, id: 2100, message: 0.005, country: "US", sunrise: 1517054882, sunset: 1517090692 }, id: 0, name: "Huntington Station", cod: 200 }

【问题讨论】:

    标签: python python-3.x openweathermap


    【解决方案1】:

    我很确定这只是临时标签。 这个是开尔文的,所以你需要翻译它

    【讨论】:

      【解决方案2】:

      如果您的 json 被加载到名为 dic 的变量中:

      print(dic['main']['temp'] * (9/5) - 459.67)
      

      wikipedia 的开尔文到华氏公式。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-08
        相关资源
        最近更新 更多