Hi All,
I'm learning Python right now (and this is actually my first threat so let me know if there is a way to ask my question in a clearer manner)
and I want to retrieve the rates from the table in attached link:
https://www.global-rates.com/interest-ra...libor.aspx
however with the following code:
Thanks a lot!
Gerald
I'm learning Python right now (and this is actually my first threat so let me know if there is a way to ask my question in a clearer manner)
and I want to retrieve the rates from the table in attached link:
https://www.global-rates.com/interest-ra...libor.aspx
however with the following code:
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':'lineItemsTable'}) 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])I receive this error:
Error:Traceback (most recent call last):
File "....\global_rates.py", line 11, in
table_body = table.find('tbody')
AttributeError: 'NoneType' object has no attribute 'find'
Can anybody help me on that?Thanks a lot!
Gerald