摘要: res = requests.get(link,).content.decode('utf8') html_ = etree.HTML(res) # 选取所有需要剔除的元素 for del_element in html_.xpath('//*[@id="newsText"]//style'): # 阅读全文
posted @ 2021-01-07 15:00 黑山老道 阅读(2825) 评论(0) 推荐(0) 编辑
摘要: # 获取上个月的时间import datetime today = datetime.date.today() # 鉴于月份只能在1-12中,月份为1月时,年份-1,月份+11,即为去年12月时间 if today.month == 1: last_month = today.replace(yea 阅读全文
posted @ 2021-01-07 14:56 黑山老道 阅读(590) 评论(0) 推荐(0) 编辑