Oct-04-2017, 11:18 AM
The page strangely lacks classes and ids so no one can target specific element directly. What you could do is to find the table you want to scrape by using the above h3 tag:
Then you can get all tr tags and from second, get the desired td. Have to use indices because as I said there is no classes or id to point to.
table = soup.find('h3', text='CONTRACTOR').find_next_sibling('table')Note find_next_sibling method.
Then you can get all tr tags and from second, get the desired td. Have to use indices because as I said there is no classes or id to point to.
address = table.find_all('tr')[1].find_all('td')[2].textFinally, you get 'S-33/34, JDA Shopping Center, Amrapali Circel, Vaishali Nagar, Jaipur' form the first url in the csv