XML to Dictionary

import xmltodict
import pprint
import json
xml_content = """
     <note>
       <to>Tove</to>
       <from>Jani</from>
       <heading>Reminder</heading>
       <body>Don't forget me this weekend!</body>
   </note>
"""
xml_content
"\n     <note>\n       <to>Tove</to>\n       <from>Jani</from>\n       <heading>Reminder</heading>\n       <body>Don't forget me this weekend!</body>\n   </note>\n"
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(json.dumps(xmltodict.parse(xml_content)))
('{"note": {"to": "Tove", "from": "Jani", "heading": "Reminder", "body": '
 '"Don\'t forget me this weekend!"}}')
dict = xmltodict.parse(xml_content)
dict
OrderedDict([('note',
              OrderedDict([('to', 'Tove'),
                           ('from', 'Jani'),
                           ('heading', 'Reminder'),
                           ('body', "Don't forget me this weekend!")]))])
dict['note']
OrderedDict([('to', 'Tove'),
             ('from', 'Jani'),
             ('heading', 'Reminder'),
             ('body', "Don't forget me this weekend!")])
dict['note']['to']
'Tove'