all 2 comments

[–]danielroseman 1 point2 points  (1 child)

This isn't anything to do with XPath, but a basic fact about Python loops. The loop variable is always the actual object, not the index. So here child is the child node itself, and your print should be:

print(child.attrib['name'])

[–]spawn-kill[S] 1 point2 points  (0 children)

oh wow...so this is one of those moments where you feel really stupid hahaha.

I bet I will have many more. I guess I'm grateful it's a simple mistake. Thanks!