On Apr 21, 2018 09:06, Peter Otten <__pete...@web.de> wrote: > > Glen wrote: > > > Thank you for your comprehensive reply. It was very helpful! > > Just to clarify one point, is it not possible to search for a node > > directly in the element / elementTree or do you first need to pull the > > data into a class/dict? > > You certainly have other options > > >>> catalog.xpath("//catalog/book[contains(title,'Guide')]/title/text()") > ["XML Developer's Guide", 'MSXML3: A Comprehensive Guide', 'Visual Studio 7: > A Comprehensive Guide'] > >>> catalog.xpath("//catalog/book[starts- > with(author,'Corets')]/title/text()") > ['Maeve Ascendant', "Oberon's Legacy", 'The Sundered Grail'] > > but then the question is whether you want to learn Python or XPath.
Neat! Can you recommend a good resource (book, webpage) for learning Xpath? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor