python:使用beautifulSoup抓网页 先安装 ``` pip install beautifulsoup4 ``` 使用requests抓取 ``` list_page = requests.get(list_url, timeout=30) list_content = list_page.content list_content = list_content.decode("utf-8") soup1 = BeautifulSoup(list_content, 'html.parser') div_items = soup1.findAll('div', attrs={'class': 'panel clearfix'}) ``` 收工,一定要指定parser,否则未定义行为会非常的坑。 来自 大脸猫 写于 2017-10-11 20:28 -- 更新于2020-10-19 13:06 -- 0 条评论