title: How to delete a particular line in xml file based on the condition using python?
body: <p>I have a problem and looking for a solution.</p>
  
  <p>I want to delete the line but based on the condition. for example the xml file is </p>
  
  <pre><code>&lt;app&gt;
      .
      .
  &lt;process&gt;
      &lt;tag&gt;any tag&lt;/tag&gt;
      &lt;trigger order="1" name="activity1" perform="y"&gt;
          &lt;external&gt;
                  &lt;action name="check_req"/&gt;
                  &lt;action name="event"/&gt;
          &lt;/external&gt;
          &lt;var name="type"/&gt;
          &lt;var name="user" /&gt;
            &lt;/trigger&gt;
  &lt;/process&gt;
  &lt;process&gt;
  &lt;tag&gt;any tag&lt;/tag&gt;
  &lt;trigger order="3" name="activity1" perform="y"&gt;
      &lt;external&gt;
              &lt;action name="check_req"/&gt;
              &lt;action name="event"/&gt;
              &lt;action name="ckeck"/&gt;
          &lt;/external&gt;
          &lt;var name="type"/&gt;
          &lt;var name="user" /&gt;
            &lt;/trigger&gt;
  &lt;/process&gt;
  &lt;process&gt;
  &lt;tag&gt;any tag&lt;/tag&gt;
  &lt;trigger order="2" name="activity1" perform="y"&gt;
      &lt;external&gt;
              &lt;action name="event"/&gt;
              &lt;action name="ckeck"/&gt;
          &lt;/external&gt;
          &lt;var name="type"/&gt;
          &lt;var name="user" /&gt;
            &lt;/trigger&gt;
  &lt;/process&gt;
  &lt;process&gt;
  &lt;tag&gt;any tag&lt;/tag&gt;
    &lt;trigger order="1" name="activity1" perform="y"&gt;
      &lt;external&gt;
              &lt;action name="check_req"/&gt;
              &lt;action name="event"/&gt;
              &lt;action name="ckeck"/&gt;
          &lt;/external&gt;
          &lt;var name="type"/&gt;
          &lt;var name="user" /&gt;
       &lt;/trigger&gt;
  &lt;/process&gt;
  &lt;process&gt;
     &lt;tag&gt;any tag&lt;/tag&gt;
     &lt;trigger order="4" name="activity1" perform="y"&gt;
      &lt;external&gt;
              &lt;action name="ckeck"/&gt;
              &lt;action name="check_req"/&gt;
          &lt;/external&gt;
          &lt;var name="type"/&gt;
          &lt;var name="user" /&gt;
     &lt;/trigger&gt;
  &lt;/process&gt;
  &lt;/app&gt;
  </code></pre>
  
  <p>So from this code I want to remove the line <code>&lt;action name="ckeck"/&gt;</code> whenever in the trigger these two action present</p>
  
  <pre><code>&lt;action name="ckeck"/&gt; 
  &lt;action name="ckeck_req"/&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;action name="ckeck_req"/&gt;
  &lt;action name="ckeck"/&gt;
  </code></pre>
  
  <p>So I have to remove the line  <code>&lt;action name="ckeck"/&gt;</code> only in the case the above two action comes together otherwise it will not remove any line.</p>
  
  <p>So am new in python language so I am unable to do this thing. The problem is that it the file contains lots of trigger blocks some of them content both action block and some contain only one action block. The particular line is to remove only iff the given case occurs </p>