import requests
from lxml import etree
import time
baseurl="https://www.295k.com/type/ribendongman-1"
for i in range(0,30):
i+=1
url=baseurl+str(i)
headers={"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"}
response=requests.get(url=url,headers=headers)
response1=response.content.decode(encoding='utf-8',errors='ignore')
response2=etree.HTML(response1)#获取请求
title1 = response2.xpath('/html/body/div[1]/div/div[1]/div/div/div[2]/ul/li/div/a/@href')
title2 = response2.xpath('/html/body/div[1]/div/div[1]/div/div/div[2]/ul/li/div/a/@title')
x=str(("https://www.295k.com/")+str(title1))
z=str(title2)
print(x)
print(z)
爬取的数据不是单独分开的 for循环也不能每页进行爬取 恳求各位给出解决方案