python学习:操作xml
import xml.etree.ElementTree as ET tree=ET.parse('demo.xml') root=tree.getroot() for child in root: print(child.tag,child.attrib) for i in child: print(i.tag,i.text)
import xml.etree.ElementTree as ET tree=ET.parse('demo.xml') root=tree.getroot() for child in root: print(child.tag,child.attrib) for i in child: print(i.tag,i.text)