【发布时间】:2019-03-19 05:59:06
【问题描述】:
我要提取的表 url 是 https://en.wikipedia.org/wiki/List_of_companies_of_Indonesia 我的代码没有给出数据。我们怎么能得到?
代码:
import requests
from bs4 import BeautifulSoup as bs
url = "https://en.wikipedia.org/wiki/List_of_companies_of_Indonesia"
html = requests.get(url).text
soup = bs(html, 'html.parser')
ta=soup.find_all('table',class_="wikitable sortable jquery-tablesorter")
print(ta)
【问题讨论】:
-
那么错误/问题是什么?
-
我没有拿到桌子
-
你得到了什么?
-
您是否尝试省略
jquery-tablesorter类,例如:find_all('table',class_="wikitable sortable") -
我得到空列表。
标签: python python-3.x url beautifulsoup python-requests