title: Same code in python3.6 produces larger file than python2.7. Bin to ASCII conversion
body: <p>Can somebody help me understand why when run under Python2 the file created by this code is much smaller (and the expected file size) than in Python3?</p>
  
  <pre class="lang-py prettyprint-override"><code>binary_str="00110111011010110101......"
  
  num_bytes = int(len(binary_str)/8)
  
  with open('output', 'w') as f:
      output_str = ""
      for i in range(num_bytes):
          output_str += chr(int(binary_str[i:i+8],2))
      f.write(output_str)
      f.close()
  </code></pre>
  
  <p>binary_str is a 1330byte long string. In Python2.7 this code produces a 1330byte file containing the relevant ascii data. When run with python3.6 balloons up in size to 1974bytes. Why this difference in behaviour?</p>