使用 python scraping 提取所有数据时出现问题
from bs4 import BeautifulSoup import requests url = "https://www.worldometers.info/coronavirus/" req_data = requests.get(url) soup = BeautifulSoup(req_data.text, 'html.parser') table = soup.find('table', attrs={'id': 'main_table_countries_today'}) for row in table.findAll('tr', attrs = {'class':['odd','even','total_row']}): print(row.text)
哆啦的时光机
噜噜哒
相关分类