soup=BeaitifulSoup(html,'html.parser')
要找到某各元素使用find_all方法就行
for div in soup.find_all('div'):
但是经常会遇到网站有反爬的设置,比如子结点中含有换行符,只要写个函数去掉子结点间的换行符就行
用re吧import re
findstr = re.compile('<(.*?)>', re.S)
print(findstr.findall(s))
soup=BeaitifulSoup(html,'html.parser')
要找到某各元素使用find_all方法就行
for div in soup.find_all('div'):
但是经常会遇到网站有反爬的设置,比如子结点中含有换行符,只要写个函数去掉子结点间的换行符就行
用re吧import re
findstr = re.compile('<(.*?)>', re.S)
print(findstr.findall(s))