reading XML file using python

Simon Brunning simon at brunningonline.net
Mon May 17 05:49:38 EDT 2010


On 17 May 2010 10:43:06 UTC+1, Shanti Bhushan <ershantibhushan at gmail.com> wrote:
> Hi simon,
> you are right in 2nd paragaraph.
> i have a piece of XML with some URLs in it that i want to
> extract.
> I have no clue from where to get help on this.
> Please atleast guide me for document or link where i can get such help
> i can use elementary tree also but i dont know how to proceed with that.

You've not given us any idea as to the structure of your XML, so this
won't work. ;-)

import xml.etree.ElementTree as ET

for node in ET.parse('our.xml'):
    print node.text

An introduction to ElementTree at <http://effbot.org/zone/element-index.htm>.

-- 
Cheers,
Simon B.



More information about the Python-list mailing list