AttributeError: module 'xml.etree.ElementTree' has no attribute 'ElimentTree'

AttributeError: module 'xml.etree.ElementTree' has no attribute 'ElimentTree'

我正在尝试从 xml 文档中删除一个元素,但出现错误 :

Traceback (most recent call last):
  File "C:/Ashok/del_element_tree_country_2.py", line 25, in <module>
    tree = ET.ElimentTree(root)
AttributeError: module 'xml.etree.ElementTree' has no attribute 'ElimentTree'

我的代码是:

import xml.etree.ElementTree as ET

tree = ET.ElementTree(file='C:\Ashok\sample.xml')

root = tree.getroot()

DisabledFeatureListForCountry = root.find('.//DisabledFeatureListForCountry')

for DisabledFeatureDetails in DisabledFeatureListForCountry.findall('DisabledFeatureDetails'):
    _id = DisabledFeatureDetails.find('Country')
    if (_id.text == "Australia"):
        DisabledFeatureListForCountry.remove(DisabledFeatureDetails)

tree = ET.ElimentTree(root)

with open(filename, "wb") as fileupdate:
    trre.write(fileupdate)

提前致谢

你的错误来自这一行:

tree = ET.ElimentTree(root)

将其替换为以下行:

tree = ET.ElementTree(root)