I want to use xpath for grabbing WhatIwant
phrase:
a="<b>AAA:</b> BBB<br/><br/><img src='line.gif' /><br/><br/><b><font size='2'>Text: </b>WahtIwant</font><br/><center>"
I want to grab WahtIwant
from a:
tree=html.fromstring(a)
tree.xpath('//font[@size="2"]/text()')
['Text: ']
Using
lxml
andtail
property (text that directly follows the element) of the element.