title: Python 3 and base64 encoding of a binary file
body: <p>I'm new to Python and I do have an issue that is bothering me.</p>
  
  <p>I use the following code to get a base64 string representation of my zip file.</p>
  
  <pre><code>with open( "C:\\Users\\Mario\\Downloads\\exportTest1.zip",'rb' ) as file:
      zipContents = file.read()
      encodedZip = base64.encodestring(zipContents)
  </code></pre>
  
  <p>Now, if I output the string it is contained inside a b'' representation. This for me is not necessary and I would like to avoid it. Also it adds a newlines character every 76 characters which is another issue. Is there a way to get the binary content and represent it without the newline characters and trailing and leading b''?</p>
  
  <p>Just for comparison, if I do the following in PowerShell:</p>
  
  <pre><code>$fileName = "C:\Users\Mario\Downloads\exportTest1.zip"
  $fileContentBytes = [System.IO.File]::ReadAllBytes($fileName)
  $fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes) 
  </code></pre>
  
  <p>I do get the exact string I'm looking for, no b'' and no \n every 76 chars.</p>