Python Xml
Python xml
生成Xml
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement
from xml.etree.ElementTree import ElementTree
from xml.dom import minidom
root = Element('vedio')
cut = SubElement(root, 'cut')
time = SubElement(cut,'time')
time.text = '2'
tree = ElementTree(root)
tree.write('result.xml', encoding = 'utf-8')
#
Xpath读取
import lxml
from lxml import etree
tree = etree.parse('result.xml')
tree.xpath("//div")