parsing an xml file

icegsiam

New Member
so I have an xml file and a python code. With the elementree lib, I have to read the paths contained in , concatenate all of those values and put them in a f_path. So far, I am able to the all path values but I can't concatenate them in my f_path:Here's my python code et the xml file:Thanks in advance\[code\]#!/usr/local/bin/python2.5# -*- coding: latin-1 -*-import xml.etree.ElementTree as ETtree = ET.parse('path.xml') rootElements = tree.getroot() for racine in rootElements.findall('racine'): path = racine.find('path').text print path if path != None: f_path = path + "/"print f_path \[/code\]\[code\]<racine name="RACINE1"> <path>MODELS</path> in here the path is : MODELS/USM/src</racine> <racine name="RACINE2"> <path>USM</path> </racine><racine name="RACINE3"> <path>src</path> </racine><racine name="RACINE4"> <path></path> </racine><racine name="RACINE5"> <path></path> </racine><racine name="RACINE6"> <path></path> </racine>\[/code\]
 
Back
Top