bs4 table examples python

Solutions on MaxInterview for bs4 table examples python by the best coders in the world

showing results for - "bs4 table examples python"
Ivan
20 Nov 2017
1data = []
2table = soup.find('table', attrs={'class':'lineItemsTable'})
3table_body = table.find('tbody')
4
5rows = table_body.find_all('tr')
6for row in rows:
7    cols = row.find_all('td')
8    cols = [ele.text.strip() for ele in cols]
9    data.append([ele for ele in cols if ele]) # Get rid of empty values