I am looping through elements of type <td> but am struggling to extract the <td> text.
HTML:
<td class="cell">
Brand Name 1
<br/>
(
<a class="tip" title="This title">
Authorised Resellers
</a>
)
</td>
: Desired output:
Brand name: Brand name 1
Brand distribution type: Authorised Reseller
I have tried:
for brand in brand_loop:
print(brand.text)
But this does not print the text following the opening <td> tag ("Brand Name 1").
Any suggestions? Thanks!
Try
for brand in brand_loop:
print(brand.text)
print(brand.find('a').text)
You can only print the text of the selected element directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With