24 May
2008
24 May
'08
6:52 a.m.
Hi, Viksit Gaur wrote:
When building a tree, I add a particular attribute to each element (eg: ID), and was wondering if there are any methods I could use to search the tree for tags that have this attribute?
I looked at find(), findall() and the xpath functions - but they seem to help only when you know the tag name itself.
You should read a bit on XPath, or at least on the ElementPath syntax. http://effbot.org/zone/element-xpath.htm The '*' wildcard allows you to search for any element tag. All iterators in lxml.etree support it, BTW. Stefan