[Python] Python Error : ImportError: No module named 'xml.etree'

Discussão em 'Python' iniciado por Stack, Setembro 25, 2024.

  1. Stack

    Stack Membro Participativo

    I am simply trying to parse an XML file:

    import xml.etree.ElementTree as ET
    tree = ET.parse('country_data.xml')
    root = tree.getroot()


    but this gives me:

    import xml.etree.ElementTree as ET
    ImportError: No module named 'xml.etree'


    I am using Python 3.5. I have tried to same code with Python 2.7 and 3.4 but I always get this error. I thought that the XML libraries come as standard. Also, I can see that in my Lib folder:

    [​IMG]

    So why can't it pick up the module? I am really confused. Do I have to make some change in an environment variable somewhere?

    Please help.

    Continue reading...

Compartilhe esta Página