xml可視化解析工具 如何用Python創(chuàng)建生成xml文檔文件的方法?
如何用Python創(chuàng)建生成xml文檔文件的方法?#Set root noderoot=element(“bookstore”)tree=elementtree(root)#Set level 1 ch
如何用Python創(chuàng)建生成xml文檔文件的方法?
#Set root node
root=element(“bookstore”)
tree=elementtree(root)
#Set level 1 child node
child0=element(“book”,{“category”:“cooking”})根.append(child0)
#設(shè)置二級子節(jié)點(diǎn)
child00=元素(“title”,{“l(fā)anguage”:“English”})
child00.text=“日常意大利語”#級別2子節(jié)點(diǎn)文本
child0。追加(child00)樹。寫入(" 測試.xml“,”utf8“)
其他可以根據(jù)上述代碼編寫