I am trying to get data from this website
But I am unable to get complete data from tables:
Here is my code:
import requests
from bs4 import BeautifulSoup
url = "https://www.moneycontrol.com/stocks/marketinfo/dividends_declared/"
r = requests.get(url)
soup = BeautifulSoup(r.text , 'html.parser')
dividendsTable = soup.find('table',class_ = 'b_12 dvdtbl')
data = []
import pandas
rows = dividendsTable.find_all('tr')
for row in rows:
st_company = row.find_all('td',class_ = "dvd_brdb")[0].text
st_type = row.find_all('td',class_ = "dvd_brdb")[1].text
st_percent = row.find_all('td',class_ = "dvd_brdb")[2].text
st_announcement = row.find_all('td',class_ = "dvd_brdb")[3].text
print(st_company,st_type,st_percent,st_announcement)
It returns list error and i am unable to change year to 2018.