[Tutor] Fwd: find second occurance of string in line

Peter Otten __peter__ at web.de
Tue Sep 8 21:37:07 CEST 2015


Albert-Jan Roskam wrote:

>> import lxml.etree
>>
>> tree = lxml.etree.parse("example.xml")
>> print tree.xpath("//objectdata/general/timestamp/text()")
> 
> Nice. I do need to try lxml some time. Is the "text()" part xpath as well?
 
Yes. I think ElementTree supports a subset of XPath.



More information about the Tutor mailing list