第一步:循环页
for x in range(1,9):
s = str(x)
r = 'https://cuiqingcai.com/category/technique/python/page/' + s
print(r)
第二步:贴到原来的标准模板中
import requests
from lxml import etree
for x in range(1,5):
s = str(x)
url1= 'https://cuiqingcai.com/category/technique/python/page/' + s
r=requests.get(url1).content
topic=etree.HTML(r)
title=topic.xpath('/html/body/section/div[2]/div/article/header/h2/a/text()')
img=topic.xpath('//*[@id="mainBox"]/main/div[2]/div/h4/a/@href')
# #
for x in title:
print(x,end=""+'\n')
# for i in img:
# print(i)
#