title: How do I remove a node in xml using ElementTree in Python?
body: <p>I've read the <code>remove</code> example <a href="http://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.iter" rel="noreferrer">here</a> and the example <a href="http://effbot.org/zone/element.htm" rel="noreferrer">here</a> is not applicable to me.</p>
  
  <p>My xml file reads:</p>
  
  <pre><code>&lt;A&gt;
    &lt;B&gt;some text&lt;/B&gt;
    &lt;B&gt;other text&lt;/B&gt;
    &lt;B&gt;more text&lt;/B&gt;
  &lt;/A&gt;
  </code></pre>
  
  <p>What I want to do is to remove the second <code>&lt;B&gt;&lt;/B&gt;</code> from the xml. I do not know what text it holds. But I have the index of the <code>&lt;B&gt;&lt;/B&gt;</code>, say index = 1, which means I want to remove the second element (or node).</p>
  
  <p>I have a code like this:</p>
  
  <pre><code>F = open('example.xml')
  self.tree = parse(F)
  self.root = self.tree.getroot()
  F.close()
  </code></pre>
  
  <p>So in this case what I want to remove is <code>self.root[1]</code>.</p>
  
  <p>How can this be implemented using ElementTree?</p>
  
  <p>Edit: Made my question more clear and specific.</p>