先安装
代码语言:javascript复制pip install beautifulsoup4
使用requests抓取
代码语言:javascript复制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,否则未定义行为会非常的坑。