You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
722 B

from .utils import *
def table(city):
try:
cursor.execute("""
SELECT 观测时间, 最高温度, 最低温度, 白天天气状况, 晚间天气状况, 降水量, 能见度, 云量
FROM weatherdata7
WHERE 城市 = %s
""", (city,))
rows = cursor.fetchall()
table_list = [(date.strftime("%m月%d"), high_temp, low_temp, day_weather, night_weather, precipitation, visibility, cloudiness)
for date, high_temp, low_temp, day_weather, night_weather, precipitation, visibility, cloudiness in rows]
except Exception as e:
print("查询错误:", e)
return None
return table_list