base64.b64encode(data)

Marko Rauhamaa marko at pacujo.net
Sun Jun 12 15:26:43 EDT 2016


Marcin Rak <mrak at sightlineinnovation.com>:

> b64_encoded_data = base64.b64encode(data)
>
> my b64_encoded_data variables holds, would you believe it, a string as
> bytes!.

It doesn't much matter one way or another. The logic is that whenever
you encode objects, you typically want the output as bytes. However,
it's trivial to decode the bytes into a string if that's what you need.


Marko



More information about the Python-list mailing list