Replacement Of Nth-child To Nth-of-type Gives An Unexpected Error
I am trying to get some information from the following web-page with BeautifulSoup: url = 'https://web.archive.org/web/20071001215911/http://finance.rambler.ru' With the help of m
Solution 1:
In selected div
it has 2 table and I will select second table
from bs4 import BeautifulSoup
import requests
url = 'https://web.archive.org/web/20071001215911/http://finance.rambler.ru'
heads = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0'}
r = requests.get(url, headers=heads)
soup = BeautifulSoup(r.text, 'html.parser')
selected_element = soup.select('div[class="fe_small fe_l2"] table')[1]
print (selected_element)
Post a Comment for "Replacement Of Nth-child To Nth-of-type Gives An Unexpected Error"