title: Python Get Base64 Encoded Byte String as a String of Bytes
body: <p>Given the python code</p>
  
  <pre><code>import base64
  byte = base64.b64encode(b'hello')
  </code></pre>
  
  <p><code>byte</code> has the value</p>
  
  <pre><code>b'aGVsbG8='
  </code></pre>
  
  <p>But I'm trying to get the string of the literal encoded bytes inside the <code>b'</code>...<code>'</code> notation.</p>
  
  <p>Only solution I've found so far is to cast the bytes as string and get the substring of the value without the first two and last characters,</p>
  
  <pre><code>str(byte)[2:-1]
  </code></pre>
  
  <p>which gives me</p>
  
  <pre><code>'aGVsbG8='
  </code></pre>
  
  <p>While this works, it feels like a complete hack.</p>