Created
January 27, 2018 02:57
-
-
Save Fhernd/f044724b2197c260135080f5336b1327 to your computer and use it in GitHub Desktop.
Escribir un archivo XML con Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
elemento_1 = ET.Element('SistemasOperativos') | |
elemento_hijo_1 = ET.SubElement(elemento_1, 'Windows') | |
elemento_hijo_2 = ET.SubElement(elemento_1, 'Linux') | |
elemento_hijo_3 = ET.SubElement(elemento_1, 'MacOS') | |
archivo = open('SistemasOperativos.xml', 'a') | |
archivo.write(ET.tostring(elemento_1, encoding='utf-8').decode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment