Inside bytes literals you may use 2 methods2 methods for specifying individual bytes:
- a direct ASCII character, e. g.
b'xyz', or - an escape sequencessequence (starting with
\), e.g.b'\n123円\x56\\'
Of course, you may combine both methods in one bytes literalsliteral, e. g. b'xy\n\x56abc'
So your b'\x6b\x0a' and b'6b0a' a both the valid bytes strings,literals - but unfortunately different:.
(The first one is 2 bytes long while the second represents 4 bytes.)
- the 1st one consists of
2bytes (represented as escape sequences\x6band\x0a) - the 2nd one consists of
4bytes (represented as ASCII characters6,b,0, anda).
Inside bytes literals you may use 2 methods for specifying individual bytes:
- direct ASCII character, e. g.
b'xyz', or - escape sequences (starting with
\), e.g.b'\n123円\x56\\'
Of course, you may combine both methods in bytes literals, e. g. b'xy\n\x56abc'
So your b'\x6b\x0a' and b'6b0a' a both the valid bytes strings, but unfortunately different.
(The first one is 2 bytes long while the second represents 4 bytes.)
Inside bytes literals you may use 2 methods for specifying individual bytes:
- a direct ASCII character, e. g.
b'xyz', or - an escape sequence (starting with
\), e.g.b'\n123円\x56\\'
Of course, you may combine both methods in one bytes literal, e. g. b'xy\n\x56abc'
So your b'\x6b\x0a' and b'6b0a' a both the valid bytes literals - but unfortunately different:
- the 1st one consists of
2bytes (represented as escape sequences\x6band\x0a) - the 2nd one consists of
4bytes (represented as ASCII characters6,b,0, anda).
Inside bytes literals you may use 2 methods for specifying individual bytes:
- direct ASCII character, e. g.
b'xyz', or - escape sequences (starting with
\), e.g.b'\n123円\x56\\'
Of course, you may combine both methods in bytes literals, e. g. b'xy\n\x56abc'
So your b'\x6b\x0a' and b'6b0a' a both the valid bytes strings, but unfortunately different.
(The first one is 2 bytes long while the second represents 4 bytes.)