Objective
To create XML you do not concatenate text: you build the tree with Element and SubElement, and tostring takes care of escaping special characters such as < and &.
Instructions
- The first line has the number
nof entries; each one is a linename value, where the value is the rest of the line. - Build a root element
datawith oneentrychild per entry (attributenameand the value as text) and show the XML withET.tostring(root, encoding="unicode").
2
a 1
b hello world
<data><entry name="a">1</entry><entry name="b">hello world</entry></data>
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise