title: Remove a line from file NOT having a specific word in Python
body: <p>Program in Python which,</p>
  
  <p>remove a line starting with <code>&lt;div</code> and ending with <code>&gt;</code> but NOT having word <code>text-align</code> in between it.</p>
  
  <p>Input:</p>
  
  <pre><code>&lt;div&gt;
  &lt;div&gt;&lt;div&gt;
  &lt;div style="text-align: center;"&gt;
  &lt;div kjgueberhfui;hh;ah&gt;
  &lt;div kjfh fhefhufh  fhueshf &gt;
  &lt;strong&gt;PANKY&lt;/strong&gt;
  &lt;div style="text-align: left;"&gt;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&lt;div style="text-align: center;"&gt;
  &lt;strong&gt;PANKY&lt;/strong&gt;
  &lt;div style="text-align: left;"&gt;
  </code></pre>
  
  <p>I am searching for something like:</p>
  
  <pre><code>f1 = open('input.txt','r')
  filedata = f1.read()
  filedata = re.sub("&lt;div[^&gt;]*/^((?!text-align).)*$/[^&gt;]*&gt;","",filedata)
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>f1 = open('input.txt','r')
  for line in f1:
      if "&lt;div" in line:
          if "text-align" in line;
          else:
              f1.write(line.replace(THIS_LINE,"")
  </code></pre>
  
  <p>The above 2 code are not working or incomplete!</p>