I'm trying to parse this website table contents, I tried using below program
import requests
from bs4 import BeautifulSoup
url = "http://www.espncricinfo.com/rankings/content/page/211270.html"
page = requests.get(url)
soup = BeautifulSoup(page.text,"html.parser")
batsman_type = (soup.find_all('h3'))[0].text
ret = []
row = {}
for tr in soup.find_all("tr"):
tds = tr.find_all("td")
if len(tds) > 0 :
row = {'Rank':tds[0].text,'Name': tds[1].text, 'Country' : tds[2].text, 'Rating': tds[3].text}
ret.append(row)
row = {}
ret.append(row)
print(ret)
when I print td it returns none value, how can I fix this in order to get all the contents of table?, If you need to any other question please feel free to ask