title: Convert file to base64 string on Python 3
body: <p>I need to convert image (or any file) to base64 string. I use different ways, but result is always <code>byte</code>, not string. Example:</p>
  
  <pre><code>import base64
  
  file = open('test.png', 'rb')
  file_content = file.read()
  
  base64_one = base64.encodestring(file_content)
  base64_two = base64.b64encode(file_content)
  
  print(type(base64_one))
  print(type(base64_two))
  </code></pre>
  
  <p>Returned</p>
  
  <pre><code>&lt;class 'bytes'&gt;
  &lt;class 'bytes'&gt;
  </code></pre>
  
  <p>How do I get a string, not byte? Python 3.4.2.</p>