In Python 3, we use "string".encode() and "string".decode() to convert an Unicode string to a bytes string, or convert a bytes string to an Unicode string.
In Python 2, we have str() and unicode(), we can encode() and decode() to them, too. But, is there any difference between Python 3?
In python2, str is byte strings, unicode is unicode string. But some silly thing for encode and decode, details refer to http://nedbatchelder.com/text/unipain.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With