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

noteElement = Element("note")

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

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

dump(noteElement)

"""
<note date="20171219"><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
"""
728x90
반응형
그리드형(광고전용)
Posted by icodebroker
TAG ,

댓글을 달아 주세요