title: Easiest way to ignore blank lines when reading a file in Python
body: <p>I have some code that reads a file of names and creates a list:</p>
  
  <pre><code>names_list = open("names", "r").read().splitlines()
  </code></pre>
  
  <p>Each name is separated by a newline, like so:</p>
  
  <pre><code>Allman
  Atkinson
  
  Behlendorf 
  </code></pre>
  
  <p>I want to ignore any lines that contain only whitespace. I know I can do this by by creating a loop and checking each line I read and then adding it to a list if it's not blank. </p>
  
  <p>I was just wondering if there was a more Pythonic way of doing it? </p>