WIP: script

This commit is contained in:
Eric Nguyen 2021-04-01 10:32:30 +02:00
parent 68acc84c50
commit 1e3cc0c702
2 changed files with 52 additions and 19 deletions

16
test.py Normal file
View file

@ -0,0 +1,16 @@
import xml.etree.ElementTree as ET
# create the file structure
data = ET.Element('data')
items = ET.SubElement(data, 'items')
item1 = ET.SubElement(items, 'item')
item2 = ET.SubElement(items, 'item')
item1.set('name','item1')
item2.set('name','item2')
item1.text = 'item1abc'
item2.text = 'item2abc'
# create a new XML file with the results
mydata = ET.tostring(data)
myfile = open("items2.xml", "w")
myfile.write(mydata)