I have an element found through BeautifulSoup that (HTML) looks like this:
<div class="ListingData">
<span id="l_Contract" class="contract">Vendita Residenziale</span><br />
New York<br />
Appartamento<br />
<strong>Prezzo:</strong>
€ 100.000/200.000
- <strong>Metri quadri:</strong>
130/170
</div>
And I need to get in one variable Vendita Residenziale, in another New York,in another Appartamento , in another 100.000/200.000 (not the strong tag) and in the last one 130/170.
I can extract the span tag text doing:
x = ele.find('span', attrs = {'class': 'contract'}).get_text()
but I'm struggling to get the other information, I tried to:
y = ele.find('div', attrs = {'class':'ListingData'}).get_text().replace("\n","").strip()
but this gives me all the div content and that's okay but I need to get the individual lines of information like a "result[1]" for New York, "result[2]" for Appartamento and so on. Is there a method?