Strings vs. Bytes
We'll cover the following...
We'll cover the following...
Bytes are bytes; characters are an abstraction. An immutable sequence of Unicode characters is called a string. An immutable sequence of numbers-between-0-and-255 is called a bytes object.
① To define a bytes object, use the b'' “byte literal” syntax. Each byte within the byte literal can be an ASCII character or an encoded hexadecimal number from \x00 to \xff (0–255).
② The type of a bytes object is bytes.
③ Just like lists and strings, you can get the length of a bytes object with the built-in len() function.
④ Just like lists and strings, you can use the +operator to concatenate bytes objects. The result is a new bytes object.
⑤ ...