lxml find tags by regex



I'm trying to use lxml to get an array of tags that are formatted as



<TEXT1>TEXT</TEXT1>

<TEXT2>TEXT</TEXT2>

<TEXT3>TEXT</TEXT3>


I tried using



xml_file.findall("TEXT*")


but this searches for a literal asterisk.


I've also try to use ETXPath but it seems to not work. Is there any API function to work with that, because assuming that TEXT is append by integers isn't the prettiest solution.


No comments:

Post a Comment