Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

I am trying to delete an element from xml document but I am getting error
:

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'

My code is:

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)

Thanks in advance

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your error comes from this line:

tree = ET.ElimentTree(root)

Replace it by the following line:

tree = ET.ElementTree(root)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading