Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

xml to python list in python

def pasrsexml(dateiname):
    d = []
    try:
        baum = dom.parse(dateiname)
        for eintrag in baum.firstChild.childNodes: 
            if eintrag.nodeName == "tr": 
                schluessel = wert = None
                wert=1
                for knoten in eintrag.childNodes: 
                    if knoten.nodeName == "td": 
                        try:
                            schluessel = knoten.firstChild.data.strip()
                        except Exception:
                           schluessel = " "
                        d.append(schluessel)
    except Exception:
        d.append("ERROR")           
    return d 
Source by www.alixaprodev.com #
 
PREVIOUS NEXT
Tagged: #xml #python #list #python
ADD COMMENT
Topic
Name
1+3 =