TypeError: unbound method parse() must be called with ElementTree instance as first argument (got str instance instead)

TypeError: unbound method parse() must be called with ElementTree instance as first argument (got str instance instead)

我正在尝试编辑 xml 文件。但是在执行下面提到的代码时,它显示错误 "TypeError: unbound method parse() must be called with ElementTree instance as first argument (got str instance instead)"。我有一个最后期限即将到来,任何帮助将不胜感激

from xml.etree.ElementTree import ElementTree as ET

tree = ET.parse('lolo.xml')

正在添加评论作为答案...

尝试将导入更改为 import xml.etree.ElementTree as ET