Python elementree having hard time extracting data

Jalascancit

New Member
Here is the XML: \[code\]<top> <target> <name>TARGET_NAME_1</name> <error_count>5</error_count> <error_examples>a string goes here</error_examples> </target> <target> <name>TARGET_NAME_2</name> <error_count>5</error_count> <error_examples>a string goes here</error_examples> </target></top>\[/code\]Here is what I'm trying: \[code\]tree = ETREE.parse(str(XML_FILE_PATH)) #this seems to worktop = tree.getroot()targets = top.findall('target')for target in targets: print target\[/code\]This gives me a \[code\]<Element target at HEX_NUMBER>\[/code\]. So how do I extract the value of each target, i.e. \[code\]TARGET_NAME_1\[/code\] ?CheersEDIT - I should mention that I'm on Python version 2.6
 
Back
Top