我对Python/BS4和数据抓取还比较陌生,所以我觉得这是一个简单的问题,但是我很难在网上找到任何资源。在
我的目标是使用this site生成随机地址,并使用BS4将它们刮取。在
我目前的代码如下:
site = 'https://www.randomlists.com/random-addresses?qty=10'
res = requests.get(site)
soup = bs4.BeautifulSoup(res.text, 'html.parser')
bigdata = soup.find('ol',{'class':'rand_large'})
print(bigdata)
返回“无”
我看到我想要的数据在一个‘ol’内,我理解为一个有序列表。我在过去做了一些基本的抓取,我很困惑为什么上面的代码找不到“rand_large”。在
有什么建议吗?在
小编辑/添加:使用
^{pr2}$退货:
^{3}$我不明白多余的“东西”是从哪里来的。在
相关问题 更多 >
编程相关推荐