Parsing xml file using nltk.corpus and ElementTree

Viewed 32

I am trying to parse through 'dream.xml' from nltk.corpus shakespeare, using elementtree.

This is my code:

from nltk.corpus import shakespeare
from xml.etree import ElementTree as ET

dream = shakespeare.xml('dream.xml')

tree = ET.parse(dream)

This is the error message I get:

TypeError: expected str, bytes or os.PathLike object, not Element
0 Answers
Related