title: Fast reading of gzip (text file) using io.BufferedReader in Python 3
body: <p>I'm trying to efficiently read in, and parse, a compressed text file using the gzip module. This <a href="https://gist.github.com/theJollySin/6eeda4a44db830a35365503178f88788" rel="nofollow noreferrer">link</a> suggests wrapping the gzip file object with <code>io.BufferedReader</code>, like so:</p>
  
  <pre><code>import gzip, io
  gz = gzip.open(in_path, 'rb')
  f = io.BufferedReader(gz)
       for line in f.readlines():
           # do stuff
  gz.close()
  </code></pre>
  
  <p>To do this in Python 3, I think <code>gzip</code> must be called with <code>mode='rb'</code>. So the result is that <code>line</code> is a binary string. However, I need <code>line</code> to be a text/ascii string. Is there a more efficient way to read in the file as a text string using <code>BufferedReader</code>, or will I have to decode <code>line</code> inside the for loop? </p>