import requests
from lxml import etree
import time
import re
url = ‘http://www.xuexili.com/mayizhuangyuan/jinridaan.html’
resp = requests.get(url)
resp.encoding = ‘utf-8’
html = etree.HTML(resp.text)
today = time.localtime()[2]
for i in range(2, 8):
answers = html.xpath(f’///table[1]/tbody/tr[{i}]‘)
# print(answers)
for j in answers:
datas = j.xpath(’./td//span/text()‘)
day = re.findall(’.?月(.*?)日’, datas[0])[0]
if int(day) == today or int(day) == today+1:
answer = ': '.join(datas)
print(answer)