I can not find the appropriate syntax or method to do this, which is why I am reaching out.
I am using python 2.7 lxml etree
my code is similar to this:
for y in mytree.iterfind('./level1/level2/level3/[2]'):
print y.tag, y.text
Essentially printing all of the available tags and text in the second iteration of the level. (I know how many there are, I am not having issues with indexing or making the function work).
I am attempting to loop through them using 'i' as a defined variable (incrementally increasing 'i' to the defined number of items).
This does not work:
for y in mytree.iterfind('./level1/level2/level3/[i]'):
print y.tag, y.text
I also tried creating the string as a variable (concatenating the text with the 'i variable as a string, but python did not recognize that it was a function anymore.
Any suggestions or help would be appreciated.