我目前正试图从这个页面上删除条形图/图表,但我不确定提取这些类型的条形图需要哪些特定的BeautifulSoup功能。此外,如果有人链接到BeautifulSoup功能用于抓取什么类型的图表/图形,我们将不胜感激https://www.statista.com/statistics/215655/number-of-registered-weapons-in-the-us-by-state/
这是我到目前为止的代码
import pandas as pd
import requests
from bs4 import BeautifulSoup
dp = 'https://www.statista.com/statistics/215655/number-of-registered-weapons-in-the-us-by-state/'
page = requests.get(dp).text
soup = BeautifulSoup(page, 'html.parser')
#This is what I am trying to figure out
new = soup.find("div", id="bar")
print(new)
此脚本将从条形图中获取所有数据:
印刷品:
也许你可以从这个网站https://www.datacamp.com/community/tutorials/web-scraping-using-python上找到更多关于网页抓取的信息
相关问题 更多 >
编程相关推荐