Read XML path into a dictionary

    0

    4

    xmlfile
    Python public recipes

    Read a XML file and return its content as a dictionary

    Shortcut: xml.file.read-as-dict

    import xmltodict
    import xml
    
    with open("filename", 'r') as xmlfile:
      try:
        result = xmltodict.parse(xmlfile.read())
      except xml.parsers.expat.ExpatError:
        # Handling error
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.