如何使用 Python 抓取维基百科表格

我想提取表 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)


四季花海
浏览 524回答 3
3回答

梦里花落0921

如果我拉着桌子看<table>标签,我总是先尝试 Pandas .read_html()。它会为您遍历行。大多数情况下,您可以准确地获得所需的内容,或者至少只需对数据框进行一些细微的操作。在这种情况下,它可以很好地为您提供完整的表格:import pandas as pdurl = "https://en.wikipedia.org/wiki/List_of_companies_of_Indonesia"table = pd.read_html(url)[1]输出:print (table.to_string())&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 50&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Industry&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Sector&nbsp; &nbsp; &nbsp; &nbsp;Headquarters&nbsp; Founded&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Notes1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Airfast Indonesia&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Airlines&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tangerang&nbsp; &nbsp; &nbsp;1971&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Private airline2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Angkasa Pura&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Transportation services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1962&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned airports3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Astra International&nbsp; &nbsp; &nbsp; &nbsp;Conglomerates&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1957&nbsp; &nbsp; Automotive, financials, industrials, technology4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bank Central Asia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Banks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1957&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank Danamon&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Banks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1956&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank Mandiri&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Banks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1998&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank7&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bank Negara Indonesia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Banks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1946&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bank8&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bank Rakyat Indonesia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Banks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1895&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Micro-finance bank9&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bumi Resources&nbsp; &nbsp; &nbsp;Basic materials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;General mining&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1973&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Mining10&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Djarum&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco&nbsp; Kudus and Jakarta&nbsp; &nbsp; &nbsp;1951&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco11&nbsp; &nbsp;Dragon Computer & Communication&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Technology&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Computer hardware&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1980&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Computer hardware12&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Elex Media Komputindo&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Publishing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1985&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Publisher13&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Femina&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Media&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1972&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Weekly magazine14&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Garuda Indonesia&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Travel & leisure&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tangerang&nbsp; &nbsp; &nbsp;1949&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned airline15&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gudang Garam&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Kediri&nbsp; &nbsp; &nbsp;1958&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco16&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gunung Agung&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Specialty retailers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1953&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bookstores17&nbsp; &nbsp; &nbsp; &nbsp;Indocement Tunggal Prakarsa&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; Building materials & fixtures&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1985&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cement, part of HeidelbergCement (Germany)18&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Indofood&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Food products&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1968&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Food production19&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Indonesian Aerospace&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Aerospace&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bandung&nbsp; &nbsp; &nbsp;1976&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned aircraft design20&nbsp; &nbsp; Indonesian Bureau of Logistics&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Food products&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1967&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Food distribution21&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Indosat&nbsp; Telecommunications&nbsp; &nbsp; &nbsp; Fixed line telecommunications&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1967&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Telecommunications network22&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Infomedia Nusantara&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Publishing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1975&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Directory publisher23&nbsp; &nbsp; &nbsp; Jalur Nugraha Ekakurir (JNE)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Delivery services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1990&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Express logistics24&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Kalbe Farma&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Health care&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pharmaceuticals&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1966&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pharmaceuticals25&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Kereta Api Indonesia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Railroads&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bandung&nbsp; &nbsp; &nbsp;1945&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned railway26&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Kimia Farma&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Health care&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pharmaceuticals&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1971&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned pharma27&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Kompas Gramedia Group&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Media agencies&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1965&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Media holding28&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Krakatau Steel&nbsp; &nbsp; &nbsp;Basic materials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Iron & steel&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cilegon&nbsp; &nbsp; &nbsp;1970&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned steel29&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Lion Air&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Airlines&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;2000&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Low-cost airline30&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Lippo Group&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; Real estate holding & development&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1950&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Development31&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Matahari&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Broadline retailers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tangerang&nbsp; &nbsp; &nbsp;1982&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Department stores32&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MedcoEnergi&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Oil & gas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exploration & production&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1980&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Energy, oil and gas33&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Media Nusantara Citra&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp;Broadcasting & entertainment&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1997&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Media34&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Panin Sekuritas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Investment services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1989&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Broker35&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Pegadaian&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Consumer finance&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1901&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned financial services36&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Pelni&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Marine transportation&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1952&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Shipping37&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Pos Indonesia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Delivery services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bandung&nbsp; &nbsp; &nbsp;1995&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned postal service38&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Pertamina&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Oil & gas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Integrated oil & gas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1957&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned oil and natural gas39&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Perusahaan Gas Negara&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Oil & gas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exploration & production&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1965&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gas40&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Perusahaan Gas Negara&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Utilities&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Gas distribution&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1965&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned natural gas transportation41&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Perusahaan Listrik Negara&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Utilities&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Conventional electricity&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1945&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned electrical distribution42&nbsp; Phillip Securities Indonesia, PT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Financials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Investment services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1989&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Financial services43&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pindad&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defense&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bandung&nbsp; &nbsp; &nbsp;1808&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State-owned defense44&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PT Lapindo Brantas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Oil & gas&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Exploration & production&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1996&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Oil and gas45&nbsp; &nbsp;PT Metro Supermarket Realty Tbk&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp;Food retailers & wholesalers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1955&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Supermarkets46&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Salim Group&nbsp; &nbsp; &nbsp; &nbsp;Conglomerates&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1972&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Industrials, financials, consumer goods47&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Sampoerna&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Surabaya&nbsp; &nbsp; &nbsp;1913&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tobacco48&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Semen Indonesia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; Building materials & fixtures&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Gresik&nbsp; &nbsp; &nbsp;1957&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cement49&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Susi Air&nbsp; &nbsp;Consumer services&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Airlines&nbsp; &nbsp; &nbsp; &nbsp; Pangandaran&nbsp; &nbsp; &nbsp;2004&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Charter airline50&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Telkom Indonesia&nbsp; Telecommunications&nbsp; &nbsp; &nbsp; Fixed line telecommunications&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Bandung&nbsp; &nbsp; &nbsp;1856&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Telecommunication services51&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Telkomsel&nbsp; Telecommunications&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Mobile telecommunications&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1995&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Mobile network, part of Telkom Indonesia52&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Trans Corp&nbsp; &nbsp; &nbsp; &nbsp;Conglomerates&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;2006&nbsp; Media, consumer services, real estate, part of...53&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Unilever Indonesia&nbsp; &nbsp; &nbsp; Consumer goods&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Personal products&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1933&nbsp; Personal care products, part of Unilever (Neth...54&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;United Tractors&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp;Commercial vehicles & trucks&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1972&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Heavy equipment55&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Waskita&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Industrials&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Heavy construction&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Jakarta&nbsp; &nbsp; &nbsp;1961&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;State-owned construction

慕田峪7331174

也许这不是你要找的。但是你可以试试这个。import requestsfrom bs4 import BeautifulSoup as bsurl = "https://en.wikipedia.org/wiki/List_of_companies_of_Indonesia"html = requests.get(url).textsoup = bs(html, 'html.parser')for data in soup.find_all('table', {"class":"wikitable"}):&nbsp; &nbsp; for td in data.find_all('td'):&nbsp; &nbsp; &nbsp; &nbsp; for link in td.find_all('a'):&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print (link.text)

慕容708150

import requestsfrom bs4 import BeautifulSoup as bsURL = "https://en.wikipedia.org/wiki/List_of_companies_of_Indonesia"html = requests.get(url).textsoup = bs(html, 'html.parser')ta=soup.find_all('table',{'class':'wikitable'})print(ta)您可以使用旧方法按类名搜索表。它似乎仍在工作。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python