Tutorial by Examples

Always encode from unicode to bytes. In this direction, you get to choose the encoding. >>> u'🐍'.encode('utf-8') '\xf0\x9f\x90\x8d' The other way is to decode from bytes to unicode. In this direction, you have to know what the encoding is. >>> b'\xf0\x9f\x90\x8d'.decode('...

Page 1 of 1