elementtree

I don't fully understand what I didn't add to the code to make it work

This code should write the number of elements in the nested list in the element in which they are <ul> < ... document.createElement('li') ul.innerHTML = ul.length ul.append('ul') } } }

How to create xml in python using xml. etree.ElementTree?

Creating xml with the following code: import xml.etree.ElementTree as ET ... some code to create xml ... mydata = ET.tostr ... <gdppc>59900</gdppc> <neighbor name="Malaysia" direction="N"/> </country> </data>