첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
import xml.etree.ElementTree

noteElement = xml.etree.ElementTree.Element("note")

noteElement.attrib["date"] = "20171219"

xml.etree.ElementTree.SubElement(noteElement, "to"     ).text = "Tove"
xml.etree.ElementTree.SubElement(noteElement, "from"   ).text = "Jani"
xml.etree.ElementTree.SubElement(noteElement, "heading").text = "Reminder"
xml.etree.ElementTree.SubElement(noteElement, "body"   ).text = "Don't forget me this weekend!"

xml.etree.ElementTree.ElementTree(noteElement).write("note.xml")
728x90
반응형
그리드형(광고전용)
Posted by icodebroker
TAG ,

댓글을 달아 주세요