回答編集履歴
2
test
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
data = response.json()
|
6
6
|
weather_data = {t: dict(zip(['天気', '風速', '風向'], d)) for t, *d in zip(*data['hourly'].values())}
|
7
7
|
|
8
|
-
print(weather_data.get('2023-02-24T20:00'))
|
8
|
+
print(weather_data.get('2023-02-24T20:00', None))
|
9
9
|
|
10
10
|
# {'天気': 0, '風速': 6.6, '風向': 9}
|
11
11
|
```
|
1
test
CHANGED
@@ -3,15 +3,9 @@
|
|
3
3
|
```python
|
4
4
|
#レスポンス
|
5
5
|
data = response.json()
|
6
|
-
weathercod
|
6
|
+
weather_data = {t: dict(zip(['天気', '風速', '風向'], d)) for t, *d in zip(*data['hourly'].values())}
|
7
|
-
windspeed = data['hourly']['windspeed_10m']
|
8
|
-
winddirection = data['hourly']['winddirection_10m']
|
9
7
|
|
10
|
-
print(weather
|
8
|
+
print(weather_data.get('2023-02-24T20:00'))
|
11
|
-
print(windspeed)
|
12
|
-
print(winddirection)
|
13
9
|
|
14
|
-
# [1, 1, 1, 2, 3, 3, 2, 2, 51, 51, ...
|
15
|
-
#
|
10
|
+
# {'天気': 0, '風速': 6.6, '風向': 9}
|
16
|
-
# [21, 11, 58, 62, 72, 39, 38, 42, 21, 9, ...
|
17
11
|
```
|