title: Reduce multiple blank lines to single (Pythonically)
body: <p>How can I reduce multiple blank lines in a text file to a single line at each occurrence?</p>
  
  <p>I have read the entire file into a string, because I want to do some replacement across line endings.</p>
  
  <pre><code>with open(sourceFileName, 'rt') as sourceFile:
      sourceFileContents = sourceFile.read()
  </code></pre>
  
  <p>This doesn't seem to work  </p>
  
  <pre><code>while '\n\n\n' in sourceFileContents:
      sourceFileContents = sourceFileContents.replace('\n\n\n', '\n\n')
  </code></pre>
  
  <p>and nor does this </p>
  
  <pre><code>sourceFileContents = re.sub('\n\n\n+', '\n\n', sourceFileContents)
  </code></pre>
  
  <p>It's easy enough to strip them all, but I want to reduce multiple blank lines to a single one, each time I encounter them.</p>
  
  <p>I feel that I'm close, but just can't get it to work.</p>