<p>我试图从美国内核俱乐部(<a href="https://www.akc.org/reg/dogreg_stats.cfm" rel="nofollow noreferrer">https://www.akc.org/reg/dogreg_stats.cfm</a>)搜集数据,但遇到了一些麻烦。我指的是<a href="https://stackoverflow.com/questions/20522820/how-to-get-tbody-from-table-from-python-beautiful-soup">this stackoverflow post</a>,我可以得到第二个表上的所有行,但我不能格式化它们。你知道吗</p>
<p>这是我的密码。你知道吗</p>
<pre><code>from bs4 import BeautifulSoup
import requests
url = https://www.akc.org/reg/dogreg_stats.cfm
r. requests.get(r)
data= r.text
soup = BeautifulSoup(data)
rows = soup.find_all('table')[1].find_all('tr')
for row in rows:
cells = soup.find_all('td')
firstRanking = cell[1].get_text()
print(firstRanking)
</code></pre>
<p>打印出来的是</p>
<pre><code>More on Registration Trends:
More on Registration Trends:
More on Registration Trends:
More on Registration Trends:
More on Registration Trends:
More on Registration Trends:
More on Registration Trends:
</code></pre>
<p>而不是实际排名。你知道吗</p>