码迷,mamicode.com
首页 > 其他好文 > 详细

xml

时间:2018-05-13 23:41:00      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:attr   encoding   new   .text   checked   utf-8   test   格式   tree   

# new_xml = ET.Element("namelist")

#

# name = ET.SubElement(new_xml, "name", attrib={"enrolled": "yes"})

# age = ET.SubElement(name, "age", attrib={"checked": "no"})

# sex = ET.SubElement(name, "sex") # sex.text = ‘33‘

# name2 = ET.SubElement(new_xml, "name", attrib={"enrolled": "no"})

# age = ET.SubElement(name2, "age")

# age.text = ‘19‘ et = ET.ElementTree(new_xml)

# 生成文档对象 et.write("test.xml", encoding="utf-8", xml_declaration=True)

#ET.dump(new_xml)

# 打印生成的格式

xml

标签:attr   encoding   new   .text   checked   utf-8   test   格式   tree   

原文地址:https://www.cnblogs.com/ooo888ooo/p/9033919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!