擅长:python、mysql、java
<p>您可以这样做:</p>
<pre><code>from bs4 import BeautifulSoup
import requests
response = requests.get(URL)
response = respnose.text
soup = BeautifulSoup(response, "lxml")
all_titles = soup.findAll("span", class_ = "itemTitle")
for title in all_titles:
title = title.find("a")
title = title.get("title")
print(title)
</code></pre>
<p>要运行此代码,您必须安装<code>lxml</code>,您可以在<code>cmd</code>中键入<code>pip install lxml</code></p>