I am relatively new to python and having trouble some trouble looping over a nodes children using xml.dom. I want to do this:
dom = parse("synth_options.xml")
root = dom.documentElement
child_nodes = root.childNode
for index, node in child_nodes:
#do stuff with index and node
However, I get this error:
Traceback (most recent call last):
File "synth.py", line 142, in <module>
for index, node in child_nodes:
TypeError: iteration over non-sequence
Strangely, this works:
for node in child_nodes:
#do stuff with index and node
I can post more code if it would be helpful, but I don't think there is anything else relevant. Thanks in advance.