3 ms·
What's stopping you from finding the answers to these questions yourself? What happens if you prefix encode with b? >>> b'these are bytes'.encode('utf8')
by tremon 4y ago
What's stopping you from finding the answers to these questions yourself?
What happens if you prefix encode with b?
>>> b'these are bytes'.encode('utf8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'bytes' object has no attribute 'encode'
What if you don’t prefix decode with b?
>>> 'this is a string'.decode('utf8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
What other possible values can go in the brackets? Can I encode and decode all types of input?
https://docs.python.org/3/library/codecs.html#standard-encodings https://docs.python.org/3/library/codecs.html#standard-encod...
Proper Unicode handling is hard for developers because many prefer not to think about it at all. Do you have an example of a language that has a Unicode conversion API that does work for you?
- andrewstuart 4y agoIf you read the thread you'll understand.