title: Remove the new line "\n" from base64 encoded strings in Python3?
body: <p>I'm trying to make a HTTPS connection in Python3 and when I try to encode my username and password the <code>base64</code> <code>encodebytes</code> method returns the encoded value with a new line character at the end "\n" and because of this I'm getting an error when I try to connect. </p>
  
  <p>Is there a way to tell the <code>base64</code> library not to append a new line character when encoding or what is the best way to remove this new line character? I tried using the <code>replace</code> method but I get the following error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "data_consumer.py", line 33, in &lt;module&gt;
      auth_base64 = auth_base64.replace('\n', '')
  TypeError: expected bytes, bytearray or buffer compatible object
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>auth = b'username@domain.com:passWORD'
  auth_base64 = base64.encodebytes(auth)
  auth_base64 = auth_base64.replace('\n', '')
  </code></pre>
  
  <p>Any ideas? Thanks</p>