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
find and findall only implement a subset of XPath. Their presence is meant to provide compatibility with other ElementTree implementations (like ElementTree and cElementTree).
The xpath method, in contrast, provides full access to XPath 1.0:
print customer.xpath('./@NAME')[0]
However, you could instead use get:
print customer.get('NAME')
or attrib:
print customer.attrib['NAME']