import xml.dom.minidom

input_xml_string = '''
<root>
<a>hello</a>
</root>
'''
#打开xml文档
#dom = xml.dom.minidom.parse(‘abc.xml‘)
dom=xml.dom.minidom.parseString(input_xml_string) #获得整个文档对象
root=dom.documentElement
print root.nodeName #节点名字
print root.nodeValue #节点值
print root.nodeType #节点类型

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2022-12-23
猜你喜欢
  • 2022-01-02
  • 2022-01-05
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案