|
|
|
@ -8,11 +8,17 @@ list_of_dicts3 = list_of_dicts2["location"]
|
|
|
|
|
# 形成列表 北投區為[0] 松山區[1] 士林區[2] 內湖區[3] 中山區[4] 中正區為[5] 信義區為[6] 大安區[7] 文山區[8] 南港區[9]
|
|
|
|
|
# for i in list_of_dicts3:
|
|
|
|
|
# print(i["locationName"])
|
|
|
|
|
list_of_dicts4 = list_of_dicts3[1]
|
|
|
|
|
list_of_dicts5 = list_of_dicts4["weatherElement"][0]
|
|
|
|
|
print("請輸入地區:(數字)")
|
|
|
|
|
x = input("北投區為[0] 松山區[1] 士林區[2] 內湖區[3] 中山區[4] 中正區為[5] 信義區為[6] 大安區[7] 文山區[8] 南港區[9]:")
|
|
|
|
|
y = int(x)
|
|
|
|
|
# for i in list_of_dicts3:")
|
|
|
|
|
location_name = list_of_dicts3[y]
|
|
|
|
|
list_of_dicts5 = location_name["weatherElement"][0]
|
|
|
|
|
list_of_dicts6 = list_of_dicts5["time"]
|
|
|
|
|
# for i in list_of_dicts6:
|
|
|
|
|
# print(i["dataTime"])
|
|
|
|
|
# 此列表為每三個小時的時間
|
|
|
|
|
for i in list_of_dicts6:
|
|
|
|
|
print(i["elementValue"][0])
|
|
|
|
|
# for i in list_of_dicts6:
|
|
|
|
|
# print(i["elementValue"][0])
|
|
|
|
|
print(list_of_dicts3[y]["locationName"])
|
|
|
|
|
print(list_of_dicts6[0])
|
|
|
|
|