Untitled

mail@pastecode.io avatar
unknown
python
a year ago
429 B
1
Indexable
Never
import xml.etree.ElementTree as xml 

def create_xml(filename):
    # Create an example XML file 
    root = xml.Element("Appointments")
    appt = xml.Element("subAppointment")
    root.append(appt)
    
    # Add appointment children
    begin = xml.SubElement(appt, "begin")
    begin.text = "1181251680"
    
    tree = xml.ElementTree(root)
    with open(filename, "wb") as fh:
        tree.write(fh)

create_xml("appt.xml")