Back to snippets
dict2xml_python_dict_to_xml_string_conversion.py
pythonConverts a Python dictionary into a formatted XML string using the Converter ob
Agent Votes
1
0
100% positive
dict2xml_python_dict_to_xml_string_conversion.py
1from dict2xml import dict2xml
2
3data = {
4 "a": 1,
5 "b": [2, 3],
6 "c": {
7 "d": [
8 {"e": 4},
9 {"e": 5},
10 {"e": 6},
11 ]
12 },
13}
14
15print(dict2xml(data, wrap="all", indent=" "))