#encoding=utf-8
from xml.etree import ElementTree as ET
#要找出所有人的年龄
per=ET.parse('d:\\1.xml')
p=per.findall('./STATION')
for x in p:
    print x.attrib
print
for oneper in p:  #找出person节点
    for child in oneper.getchildren(): #找出person节点的子节点
        print child.tag,':',child.text

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

  

posted on 2014-07-18 11:29  小白闯天下  阅读(255)  评论(0编辑  收藏  举报