Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python elementtree build xml

import xml.etree.cElementTree as ET

root = ET.Element("root")
doc = ET.SubElement(root, "doc")

ET.SubElement(doc, "field1", name="blah").text = "some value1"
ET.SubElement(doc, "field2", name="asdfasd").text = "some vlaue2"

tree = ET.ElementTree(root)
tree.write("filename.xml")
Comment

PREVIOUS NEXT
Code Example
Python :: enumurate in python 
Python :: set x label matplotlib 
Python :: button icon pyqt5 
Python :: add year to id django 
Python :: how to make a module that generates a random letter in python 
Python :: django logout 
Python :: how to save model to a file python 
Python :: python get average list in 2d array 
Python :: python program to find all prime numbers within a given range 
Python :: how to display speechmarks in python string 
Python :: pyrogram 
Python :: list python shuffling 
Python :: redis get all keys and values python 
Python :: Right click context menu of a file in Python 
Python :: ImportError: No module named _tkinter, please install the python-tk package 
Python :: selenium send keys python 
Python :: aioschedule python 
Python :: truncate add weird symbols in python 
Python :: firebase-admin python 
Python :: load all csv files in a folder python pandas 
Python :: simple gui for pygame 
Python :: procfile heroku django 
Python :: Running setup.py bdist_wheel for opencv-python: still running... 
Python :: pandas normalize groupby 
Python :: pandas plot heatmap 
Python :: remove rows or columns with NaN value 
Python :: python program to give shop name 
Python :: python image black and white 
Python :: django getting started 
Python :: Print a nested list line by line in python 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =