I want to grab only string from here :
<br>
5 Brown Circle<br>
Alabaster,
AL
35007
I need solid understanding how to extract text from the above portion following html doc:
<tr class="prem-tr" id="10425" role="row">
<td>
<h4><a class="prem-result-link" href="/Search/Details/10425">Graham & Associates, CPAs</a></h4>
<a href="tel:+(205) 663-6673">(205) 663-6673</a>
<br>
5 Brown Circle<br>
Alabaster,
AL
35007
<div class="row result-btmRow">
<div class="col-sm-4">
<span class="result-dist"><small>Distance: 0.00 miles</small></span>
</div><!-- col6 -->
<div class="col-sm-8 result-actions">
<a id="WebsiteURL" class="visit-site" href="http://grahamandassociates.net" target="_blank">Visit Website</a>
<a class="send-email" href="/Search/Details/10425">Send a Message</a>
</div><!-- /col6 -->
</div><!-- /row -->
</td>
</tr>
Expected output:5 Brown Circle, Alabaster, AL 35007
using only xpath along with explanation.
OR
In css selectors, it's working fine.Can anyone explain the following code? Thanks
" ".join([" ".join(el.root.strip().split()) for el in sel.css("td::text") if el.root.strip()])