I need to get just the top div tag without its nested tags.
<div class="listing-price">
K75,000
<span class="listing-price-sqm">$750000/m<sup>2</sup></span>
</div>
The code I have returns both the value from the div class tag and the span class tag :
listing_price = house.find("div", class_="listing-price").text.strip()
How can I get just the value K75,000?
Thanks
string
instead oftext
and check it again. And also add output of your code to your question. – iliyastrip()
from fromstring
? Do it like this and report back. – iliya