import os,sys
import requests
from bs4 import BeautifulSoup
import re
#-------------------------------------
url='http://www.dashuzhai.com/lingyikongbu/yichangguishi/yichangguishi1guIDAopia/'
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
}
r=requests.get(url,headers=headers)
r.encoding="gbk"
mulu=BeautifulSoup(r.text,'html.parser')
print(mulu.find('title').get_text()[0:8])
dict={}
for i in mulu.find_all('div',class_="mulu"):
for j in i.find_all('ul'):
print(j.find('a').getText())
print(mulu.find('title').get_text()[0:8])
dict={}
for i in mulu.find_all('div',class_="mulu"):
j = i.find_all('li')
for li_a in j:
print(li_a.find('a').getText())