Sep-24-2019, 04:38 PM
Thanks Buran! I will follow the correct tagging going forward!
What would be the correct table tag to retrieve the table with the rates?
If I use 'tabledata1' I receive the same error:
What would be the correct table tag to retrieve the table with the rates?
If I use 'tabledata1' I receive the same error:
import urllib.request as ur from bs4 import BeautifulSoup url = input('Enter URL: ') html = ur.urlopen(url).read() soup = BeautifulSoup(html, 'html.parser') data = [] table = soup.find('table', attrs={'class':'tabledata1'}) table_body = table.find('tbody') rows = table_body.find_all('tr') for row in rows: cols = row.find_all('td') cols = [ele.text.strip() for ele in cols] data.append([ele for ele in cols if ele])