"Sithembewena Lloyd Dube" <zebr...@gmail.com> wrote
And now, to iterate through its child nodes and print out the text
of each
node:
for node in xml_content.getiterator('contest'):
... name = node.attrib.get('text')
... print name
...
Nothing is printed,
i = 0
for node in xml_content.getiterator('contest'):
... i += 1
...
i
0
What am I getting wrong? Any hints would be appreciated.
Looks like you are getting an empty list back.
Try printing list(xml_content.getiterator('contest'))
And if thats empty try checking the case of your tag?
I'm pretty sure it will be case sensitive?
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor