Skip to content Skip to sidebar Skip to footer

Rewrite Elementtree Code In Lxml

I am writing a code to extract text from a xml file using ElementTree but I found out that lxml is giving xpath features which is more convenient. So i want to know how this lin

Solution 1:

I'm assuming you are already at a stage where you're ready to use an xpath. If not http://lxml.de/parsing.html should help. The xpath for finding the element, you are searching for in your first line should look like this:

"//a:pPr[@lvl=2 and not(@marL)]"

I however have to admit that I have no idea how your second snippet should find that element O_o

Post a Comment for "Rewrite Elementtree Code In Lxml"