import requests
import re
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'}
for i in range(1,8):
link='https://blog.csdn.net/lws123253/article/list/'+str(i)+'?'
#第一页地址:https://blog.csdn.net/lws123253/article/list/1?
#最后一页地址:https://blog.csdn.net/lws123253/article/list/7?
r=requests.get(link,headers=headers)
title_list=re.findall('<span class=.*?</span>(.*?)</a>',r.text)#中间的(.*?)表示提取匹配到内容的括号内部分
for title in title_list:
print(title.strip())