I want to use an xpath expression to get the value of an attribute.
I expected the following to work
from lxml import etree
for customer in etree.pa
As a possible useful addition, this is how to get the value of an attribute in the case that the element has more than one, and it is the only difference with respect to another element. E.g., given the following file.xml:
8
8
One can access the attribute 'bar' with:
import lxml.etree as etree
tree = etree.parse("test_file.xml")
print tree.xpath("//level1/level2[@first_att='att2']/@second_att")[0]