【发布时间】:2020-06-14 00:41:43
【问题描述】:
我正在从该网站https://www.iban.com/country-codes 的表格中进行网络抓取,但将其放入 DataFrame 时,抓取的信息不完整。
# Webscrape list of official countries with country codes
url = 'https://www.iban.com/country-codes'
response = requests.get(url)
page = response.content
scraping = BeautifulSoup(page, "lxml")
scraping
element = scraping.find("table", attrs={"class" : "table table-bordered downloads tablesorter"})
df = pd.read_html(str(element))
countrycodes = df[0]
因此,例如,菲律宾 (the)、大不列颠及北爱尔兰联合王国 (the)、瑞士等国家/地区不属于数据框。
【问题讨论】:
标签: python html web-scraping beautifulsoup