import xmltodict
      import xml
      
      with open("filename", 'r') as xmlfile:
        try:
          result = xmltodict.parse(xmlfile.read())
        except xml.parsers.expat.ExpatError:
          # Handling error
      
      Python language logo

      Read XML path into a dictionary

      xml
      file
      Python public recipes

      Read a XML file and return its content as a dictionary

      Shortcut: xml.file.read-as-dict

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.