I want to iterate //span[@class="postNum and contains(text(),1)] This xpath over the range of 1 to 10 and store it in a variable. I want it to be done in HTML format and not XML.
pseudo code:
for e in range(1,11):
     xpathvar[e]='//span[@class="postNum and contains(text(),e)]'
how to implement this so that xpathvar[1] will contain the first xpath with e=1. I cannot do this because the element in RHS is a string.
I solved it myself. What I wanted to do was with using slice, I wanted to traverse to all xpath using iteration where the iterative will be in digits coming from for loop.
How to iterate over a XPath in HTML format using lxml and python?