Xml-File-To-Dict
Sat 17 May 2025
title: "XML File to Dictionary" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
import xmltodict
import pprint
import json
with open('sample.xml') as fd:
doc1 = xmltodict.parse(fd.read())
doc1
OrderedDict([('note',
OrderedDict([('to', 'Tove'),
('from', 'Jani'),
('heading', 'Reminder'),
('body', "Don't forget me this weekend!")]))])
doc1['note']['heading']
'Reminder'
Score: 5
Category: basics