4 ms·
It is in Python 2, but not in Python 3, where str.encode() and bytes.decode() have been restricted to only convert between strings and bytes. >>> "foo".enc
by tveita 11y ago
It is in Python 2, but not in Python 3, where str.encode() and bytes.decode() have been restricted to only convert between strings and bytes.
>>> "foo".encode('zlib')
LookupError: 'zlib' is not a text encoding; use codecs.encode() to handle arbitrary codecs