擅长:python、mysql、java
<p>硒对你所需要的可能有点过头了,好的老美容师也能做到这一点。在</p>
<pre><code>import urllib.request, bs4
body = urllib.request.urlopen(urllib.request.Request("http://www.allitebooks.com/page/1/?s=python", headers={"User-Agent": "Mozilla"})).read().decode("utf-8")
soup = bs4.BeautifulSoup(body)
for element in soup.find_all("h2", class_="entry-title"):
for link in element.find_all("a"):
print(link.get("href"))
</code></pre>