Beautiful Soup是抓取网页常用的一个模块,用于从HTML页面中提取信息,它显然比正则表达式好用很多。
简单示例
我们先来看下如何解析下面这个简单的HTML文件:
<!-- This is the example.html example file. -->
<html>
<head><title>The Website Title</title></head>
<body>
<p>Download my <strong>Python</strong> book from <a href="http://
inventwithpython.com">my website</a>.</p>
<p class="slogan">Learn Python the easy way!</p>
<p>By