This is a sample query I might do in PHP:
foreach(steps as step)
{
areT_eles = xpath->query(t_eleQuery, step)
}
Now in python:
for step in index steps:
areT_eles = ?!?!?!?!!??!?!!??!!
I tried this:
for step in index steps:
areT_eles = xpath.query(t_eleQuery, step)
It didn’t work. I’ve only imported Elementtree from xml.etree.ElementTree, though.
The most official page I was able to find on xpath in elementtree actually didn’t have any documentation or examples…. And we all know how horribly bad Python official’s tutorials are. So, I’m also looking for a good resource.
If you have LXML, the high-performance, full-featured version of ElementTree, installed you can use XPath as follows:
I can recommend LXML for all your Python XML needs; it’s fast and Pythonic.