I am trying to get the data in one of span class from a website. Currently, I caught the correct position of my data but I can’t get the text of class.
My output: [$14.22]
My code:
import requests
from bs4 import BeautifulSoup
res = requests.get('https://coinmarketcap.com/currencies/chainlink/')
soup = BeautifulSoup(res.text, 'lxml')
elements = soup.find_all("span", class_="sc-f70bb44c-0 flfGQp flexStart alignBaseline")
values = soup.find_all("span", class_="sc-f70bb44c-0 jxpCgO base-text")
print(values)
My output:
[$14.22]
My expectation is get the only “$14.22”
New contributor
Bùi Huy Trường is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.