bytes

An immutable sequence of small integers from 0 to 255, the raw form of encoded text and binary data.

In more detail

str.encode() returns bytes and bytes.decode() returns a string. A byte is eight bits, and UTF-8 uses one to four bytes for each character. Literals are written with a b prefix, such as b'A'.

Example

print('\u00e9'.encode('utf-8'))   # b'\xc3\xa9'

Related terms

Taught in

References

Certification courses