Skip to content

Instantly share code, notes, and snippets.

@apackeer
Created December 5, 2012 09:25
Show Gist options
  • Select an option

  • Save apackeer/4214230 to your computer and use it in GitHub Desktop.

Select an option

Save apackeer/4214230 to your computer and use it in GitHub Desktop.
DictToXml
from xml.etree.ElementTree import Element, SubElement, tostring
def DictToXML(data,root='data'):
root = Element(root)
for (field, val) in data.iteritems():
SubElement(root, field).text = val
return tostring(root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment