Having trouble importing nltk.etree.elementtree
Question: I'm following along with Natural Language Processing with Python. when i run

    
    
    from nltk.etree.ElementTree import ElementTree
    

I get this error:

    
    
    ImportError: No module named etree.ElementTree
    

Why is this?


Answer: etree was removed from ntlk back in 2012
(<https://github.com/nltk/nltk/issues/80>):

> StevenBird1 said, at 2011-03-31T05:10:58.000Z:
>
> Yes -- etree has been in the standard library since version 2.5. It was just
> a temporary measure to include etree for the benefit of people using 2.4.

This should work for you:

    
    
    from xml.etree.ElementTree import ElementTree
    

