I want to save data in xml in this format
<posts>
    <row Id="1" PostTypeId="1" AcceptedAnswerId="13" 
         CreationDate="2010-09-13T19:16:26.763" Score="297" ViewCount="472045" 
         Body="<p>This is a common question by those who have just rooted their phones.  What apps, ROMs, benefits, etc. do I get from rooting?  What should I be doing now?</p>
" 
         OwnerUserId="10" 
         LastEditorUserId="16575" LastEditDate="2013-04-05T15:50:48.133" 
         LastActivityDate="2018-05-19T19:51:11.530" 
         Title="I've rooted my phone.  Now what?  What do I gain from rooting?" 
         Tags="<rooting><root-access>" 
         AnswerCount="3" CommentCount="0" FavoriteCount="194" 
         CommunityOwnedDate="2011-01-25T08:44:10.820" />
</posts>
I tried this, but I don't know how will I save in the above format:
import xml.etree.cElementTree as ET
root = ET.Element("posts")
row = ET.SubElement(root, "row")
ET.SubElement(row, questionText = "questionText").text = questionText
            ET.SubElement(row, votes = "votes").text = votes
            ET.SubElement(row, tags = "tags").text = tags
tree = ET.ElementTree(root)
            tree.write("data.xml")
 
     
    