Skip to content

Commit 29882fa

Browse files
committed
拼写错误
1 parent c7f2b1b commit 29882fa

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

WeatherMonitor/weather_monitor.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ def get_weather(key):
2929
payload = {'location': 'beijing', 'key': key}
3030
r = requests.get('https://free-api.heweather.com/s6/weather/forecast', params=payload)
3131
today_forecast = r.json()['HeWeather6'][0]['daily_forecast'][0]
32-
tomorow_forecast = r.json()['HeWeather6'][0]['daily_forecast'][1]
32+
tomorrow_forecast = r.json()['HeWeather6'][0]['daily_forecast'][1]
3333
today_code_n = today_forecast['cond_code_n']
34-
tomorow_code_d = tomorow_forecast['cond_code_d']
34+
tomorrow_code_d = tomorrow_forecast['cond_code_d']
3535
print('today_code_n = ' + today_code_n)
36-
print('tomorow_code_d = ' + tomorow_code_d)
36+
print('tomorrow_code_d = ' + tomorrow_code_d)
3737
weather_content = air_content = temprature_content = ''
3838
today_txt_n = today_forecast['cond_txt_n'] # 今天夜间天气状况文字
39-
tomorow_txt_d = tomorow_forecast['cond_txt_d'] # 明天白天天气状况文字
39+
tomorrow_txt_d = tomorrow_forecast['cond_txt_d'] # 明天白天天气状况文字
4040
today_tmp_max = today_forecast['tmp_max'] # 今天最高气温
4141
today_tmp_min = today_forecast['tmp_min'] # 今天最低气温
42-
tomorow_tmp_max = tomorow_forecast['tmp_max'] # 明天最高气温
43-
tomorow_tmp_min = tomorow_forecast['tmp_min'] # 明天最低气温
44-
if (int(today_code_n) > 299 and int(today_code_n) < 500) or (int(tomorow_code_d) > 299 and int(tomorow_code_d) < 500):
45-
weather_content = '降水注意:' + '\n' + '今天夜间天气为【' + today_txt_n + '】,最高气温:' + str(today_tmp_max) + '°C,最低气温:' + str(today_tmp_min) + '°C;' + '\n' + '明天白天天气为【' + tomorow_txt_d + '】,最高气温' + str(
46-
tomorow_tmp_max) + '°C,最低气温' + str(tomorow_tmp_min) + '°C。' + '\n'
42+
tomorrow_tmp_max = tomorrow_forecast['tmp_max'] # 明天最高气温
43+
tomorrow_tmp_min = tomorrow_forecast['tmp_min'] # 明天最低气温
44+
if (int(today_code_n) > 299 and int(today_code_n) < 500) or (int(tomorrow_code_d) > 299 and int(tomorrow_code_d) < 500):
45+
weather_content = '降水注意:' + '\n' + '今天夜间天气为【' + today_txt_n + '】,最高气温:' + str(today_tmp_max) + '°C,最低气温:' + str(today_tmp_min) + '°C;' + '\n' + '明天白天天气为【' + tomorrow_txt_d + '】,最高气温' + str(
46+
tomorrow_tmp_max) + '°C,最低气温' + str(tomorrow_tmp_min) + '°C。' + '\n'
4747
print(weather_content)
48-
if (int(today_code_n) > 501 and int(today_code_n) < 900) or (int(tomorow_code_d) > 501 and int(tomorow_code_d) < 900):
49-
air_content = '空气质量注意:' + '\n' + '今天夜间天气为【' + today_txt_n + '】;' + '\n' + '明天白天天气为【' + tomorow_txt_d + '】' + '\n'
48+
if (int(today_code_n) > 501 and int(today_code_n) < 900) or (int(tomorrow_code_d) > 501 and int(tomorrow_code_d) < 900):
49+
air_content = '空气质量注意:' + '\n' + '今天夜间天气为【' + today_txt_n + '】;' + '\n' + '明天白天天气为【' + tomorrow_txt_d + '】' + '\n'
5050
current_month = time.strftime("%m", time.localtime())
5151
if (int(current_month) > 0 and int(current_month) < 5) or (int(current_month) > 8 and int(current_month) <= 12):
5252
print('当前是%s月%s日' % (current_month, time.strftime("%d", time.localtime())))
53-
if (int(tomorow_tmp_min) - int(today_tmp_min)) <= -5:
54-
temprature_content = '温度注意:明日最低气温为' + tomorow_tmp_min + '°C!' + '\n'
53+
if (int(tomorrow_tmp_min) - int(today_tmp_min)) <= -5:
54+
temprature_content = '温度注意:明日最低气温为' + tomorrow_tmp_min + '°C!' + '\n'
5555
if int(current_month) > 4 and int(current_month) < 9:
5656
print('当前是%s月%s日' % (current_month, time.strftime("%d", time.localtime())))
57-
if ((int(tomorow_tmp_max) - int(today_tmp_max)) >= 5) or (int(tomorow_tmp_max) >= 30):
58-
temprature_content = '温度注意:明日最高气温为' + tomorow_tmp_max + '°C!' + '\n'
57+
if ((int(tomorrow_tmp_max) - int(today_tmp_max)) >= 5) or (int(tomorrow_tmp_max) >= 30):
58+
temprature_content = '温度注意:明日最高气温为' + tomorrow_tmp_max + '°C!' + '\n'
5959

6060
return weather_content + air_content + temprature_content
6161

0 commit comments

Comments
 (0)