import requests
from bs4 import BeautifulSoup
url="https://www.shicimingju.com/book/sanguoyanyi.html"
head={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74"
}
re=requests.get(url=url,headers=head)
re.encoding=re.apparent_encoding
page=BeautifulSoup(re.text,'html.parser')
mid=page.find('div',attrs={'class':'book-mulu'})
lis=mid.find_all('li')
u='https://www.shicimingju.com'
for ind in lis:
a=ind.find('a')
content=a.text
ur=u+a.get('href')
print(content,ur)