title: Count number of lines in a txt file with Python excluding blank lines
body: <p>I wish to count the number of lines in a .txt file which looks something like this:</p>
  
  <pre><code>apple
  orange
  pear
  
  hippo
  donkey
  </code></pre>
  
  <p>Where there are blank lines used to separate blocks. The result I'm looking for, based on the above sample, is five (lines).</p>
  
  <p>How can I achieve this?</p>
  
  <p>As a bonus, it would be nice to know how many blocks/paragraphs there are. So, based on the above example, that would be two blocks.</p>