title: Spliting a file into lines in Python using re.split
body: <p>I'm trying to split a file with a list comprehension using code similar to:</p>
  
  <pre><code>lines = [x for x in re.split(r"\n+", file.read()) if not re.match(r"com", x)]
  </code></pre>
  
  <p>However, the lines list always has an empty string as the last element. Does anyone know a way to avoid this (excluding the cludge of putting a pop() afterwards)?</p>