Skip to content

Instantly share code, notes, and snippets.

View dedenhabibi's full-sized avatar

Deden H. A. Alfathimy dedenhabibi

View GitHub Profile
@dedenhabibi
dedenhabibi / dict_to_xml.py
Last active February 5, 2020 12:27
Function to convert dict/list into XML, with support attribute
from xml.etree.ElementTree import Element, tostring
def xml_to_str(the_xml):
return tostring(the_xml)
def list_to_xml(each_tag, the_list):
elements = []
for item in the_list:
element = Element(each_tag)
if type(item) is list: