Apr-28-2024, 04:57 PM
What do you mean by "send binary code"? Do you want to send a binary string (bytes 30 and 31)? That would be b'00001111' or bytes((30, 30, 30, 30, 31, 31, 31, 31)).
Do you want to send 15? That would be bytes((15)) or b'\08'. There is no escape sequence for binary digits like there is for hexadecimal digits.
Do you have a binary string that you want to convert to bytes? Gribouillis covers that in his post. I would not do this for literals in the program, but if you have entered strings that need to be converted, it will do the trick.
Do you want to send 15? That would be bytes((15)) or b'\08'. There is no escape sequence for binary digits like there is for hexadecimal digits.
Do you have a binary string that you want to convert to bytes? Gribouillis covers that in his post. I would not do this for literals in the program, but if you have entered strings that need to be converted, it will do the trick.