python读取xml内容

#encoding=utf-8

from xml.etree import ElementTree as ET

per=ET.parse('d:/test.xml')

p=per.findall('/person')

all = ''

for oneper in p:  

    for child in oneper.getchildren(): 

        all = all + child.text+','

    print all

    print '############'

 

 

脚本语言就是强大。

你可能感兴趣的:(python)