【发布时间】:2020-10-24 13:06:41
【问题描述】:
我正在尝试编写一个从this wikipedia 页面中提取表格的刮板。问题是,我可以提取页面上的所有表格,除了我实际需要的表格(这是包含所有统计信息的表格曾经在美国进行过的选举)。我不认为问题出在我的标签上。
这是我的代码
from urllib.error import HTTPError
from urllib.error import URLError
from bs4 import BeautifulSoup
from urllib.request import urlopen
#getting the wiki page
page_info=urlopen('https://en.wikipedia.org/wiki/United_States_presidential_election')
soup=BeautifulSoup(page_info, 'html.parser')
headline=soup.find('table', "wikitable sortable jquery-tablesorter")
print(headline)
我认为我缺少一些重要的东西,但我无法理解它。谁能帮帮我。
【问题讨论】:
标签: python-3.x web-scraping beautifulsoup urllib