1、Python(lxml解析器,BeautifulSoup4安装)
Beautiful Soup 4.4.0 文档
https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/
安装BeautifulSoup4
安装成功了
当然我们要配置lxml解析器一起用下面来安装下
2、Python内容遍历三种方法
代码如下:
"""
使用BeautifulSoup
"""
from bs4 import BeautifulSoup
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
<a href=