http://www.xuexili.com/mayizhuangyuan/jinridaan.htmlimport requests
from lxml import etree
import time
import re
url = ‘https://www.app178.com/dujia/248082.html’
resp = requests.get(url)
resp.encoding = ‘utf-8’
html = etree.HTML(resp.text.encode(‘gbk’).decode(‘gbk’))
today = time.localtime()[2]
for i in range(2, 5):
answers = html.xpath(f’///table/tbody/tr[{i}]//td/text()‘)
day = re.findall(’.?月(.*?)日’, answers[0])[0]
if int(day) == today:
answer = ': '.join(answers)
print(answer)