title: Remove multiple new lines to 1 new line from a file
body: <p>2 parameters <code>file_in</code> and <code>file_out</code> and I need to convert (<code>'a\n\n\n\na'</code>) to (<code>'a\n\na'</code>) multiple times. I tried with <code>re.sub(r'[\r\n][\r\n]{2,}', '\n\n', file_out)</code> but nothing works Anyone have an idea? </p>
  
  <pre class="lang-none prettyprint-override"><code>         --------------------
            aaa
  
  
            bbb
  
  
  
  
            ccc
            --------------------
  
      needed to be converted to
  
            --------------------
            aaa
  
            bbb
  
            ccc
            --------------------
  </code></pre>