selecting attribute values from lxml

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']

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)