def _showWeather(self, city):
self.info.insert(tk.INSERT, u'?????? #%s, %s# ???...\n\n\n' % (
city.get(u'city_name_ch'), city.get(u'parent_name_ch')))
weather_content = self.api.getWeather(city.get(u'id'))
soup = BeautifulSoup(weather_content, u'html.parser')
table_tag = soup.find_all(u'table', class_=u'sevendays')[0]
for child in table_tag.children:
if not isinstance(child, Tag):
continue
date = child.find(u'td', class_=u'date').get_text()
temp = child.find(u'td', class_=u'temp').get_text()
desc = child.find(u'td', class_=u'desc').get_text()
self.info.insert(tk.INSERT, ''.join(date.split()) + '\n')
self.info.insert(tk.INSERT, ''.join(temp.split()) + '\n')
self.info.insert(tk.INSERT, ''.join(desc.split()) + '\n')
self.info.insert(tk.INSERT, u'=================' + '\n')
评论列表
文章目录