loading...

strings in python2 and python3

Tony Colston on January 15, 2020

I have written a lot of code in Python2. Not as much in Python3. One thing I used Python for a lot is to quickly convert string values into base64... [Read Full]
markdown guide
 

Luckily you can type byte string literals in Python3: base64.b64encode(b'test')
That should make it as neat and simple as in Python2!

 

Even better than mine! Good catch.

 

I haven't benchmarked this or anything, but there's also str.encode as an alternative to the bytes constructor.

code of conduct - report abuse