I'd like to test the content of a variable containing a byte in a way like this:
line = []
while True:
for c in self.ser.read(): # read() from pySerial
line.append(c)
if c == binascii.unhexlify('0A').decode('utf8'):
print("Line: " + line)
line = []
break
But this does not work... I'd like also to test, if a byte is empty: In this case
print(self.ser.read())
prints: b'' (with two single quotes)
I do not until now succeed to test this
if self.ser.read() == b''
or what ever always shows a syntax error...
I know, very basic, but I don't get it...
b''is an emptybytes, which is the correct thing to compare against."b''"is a three characterstr(which in Python 2 happens to be the same thing asbytes, but we don't know what Python version is in use here).