Jun-11-2018, 04:54 AM
Hello,I 'm learning python and beatiful soup. Unfortunately, theory 's one thing and practise is another. I 'm trying to scrape a site, and to be more accurate a tag / style. Here 's the code.
[<td class="Estilo4">24.98</td>, <td class="Estilo4">25.98</td>]
Till here it 's OK, but what I relly need it's the numbers between the TD tags, both of them(first and second TD).
Is there a way to extract them in order to save it in a variable.
# Import libraries
import requests
from bs4 import BeautifulSoup
URL = "https://www.preciodolar.com.ar"
r = requests.get(URL)
# print(r.content)
# Create a BeautifulSoup object
soup = BeautifulSoup(r.content)
print(soup.prettify())
dolar = soup.find_all("td", class_="Estilo4")
print (dolar)output: [<td class="Estilo4">24.98</td>, <td class="Estilo4">25.98</td>]
Till here it 's OK, but what I relly need it's the numbers between the TD tags, both of them(first and second TD).
Is there a way to extract them in order to save it in a variable.
