title: How do I remove a node in xml using ElementTree in Python by searching attributes of an element?
body: <p><strong>Sample xml file:</strong></p>
  
  <pre><code>&lt;root&gt;
     &lt;child1 /&gt;
     &lt;child2 bksetname="Default Backup Set" /&gt;
     &lt;child3 bksetname="Local Backup Set" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import xml.etree.ElementTree as ET
  
  tr = ET.parse("Scheduler.xml")
  for elem in tr.iter():
      print elem.tag , elem.attrib
      if elem.attrib.get('bksetname') == "Default Backup Set":
          elem.remove(elem.tag)
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>Entering elem:
  self._children.remove(element)
  child2
  ValueError: list.remove(x): x not in list
  </code></pre>
  
  <p>I am trying to delete the element by searching the element in file, if it has the attribute I want.I tried this way in my code and getting error in my output as shared.
  Please tell me how can I do this using xml.etree.ElementTree package.</p>