I need to concat a single byte with the bytes I get from a parameter string.
byte_command = 0x01
socket.send(byte_command + bytes(message, 'UTF-8'))
but I get this error:
socket.send(byte_command + bytes(message, 'UTF-8'))
TypeError: str() takes at most 1 argument (2 given)
I assume this happens because I am using the string concat operator - how do I resolve that?
byte_command = 0x01, it is an int, if you want thebytesrepresentation, usebyte_command = b"\x01".bytes()...If message is a string, then you needmessage.encode()... But is this really Python 3?