使用Python爬取网页后,过滤掉网页中的注释标签
from bs4 import BeautifulSoup, Comment
soup = BeautifulSoup(res.text, 'html.parser')
comments = soup.find_all(text=lambda text: isinstance(text, Comment))
from bs4 import BeautifulSoup, Comment
soup = BeautifulSoup(res.text, 'html.parser')
comments = soup.find_all(text=lambda text: isinstance(text, Comment))