Advertisement
Fhernd

escribir-xml.py

Jan 26th, 2018
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import xml.etree.ElementTree as ET
  2.  
  3. elemento_1 = ET.Element('SistemasOperativos')
  4. elemento_hijo_1 = ET.SubElement(elemento_1, 'Windows')
  5. elemento_hijo_2 = ET.SubElement(elemento_1, 'Linux')
  6. elemento_hijo_3 = ET.SubElement(elemento_1, 'MacOS')
  7.  
  8. archivo = open('SistemasOperativos.xml', 'a')
  9.  
  10. archivo.write(ET.tostring(elemento_1, encoding='utf-8').decode('utf-8'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement