The problem of hexadecimal array output from pyserial serial port

1. Use pyserial to send a hexadecimal array to the lower computer, the test code is as follows.

def order_list():
    a = "aa0902630000bb"
    a_list = []
    for i in a.split():
        a_list.append(binascii.a2b_hex(i))
    return a_list

ser = serial.Serial("/dev/ttyUSB0", 9600)
ser.writelines(order_list())

question: why is there an extra b in the list after the execution of list.append? Where did this"b "come from, or does this b represent a data type? But if it"s a data type, why do I print the first list element, and why does this b also print out?

Mar.01,2021

b means that bytes object, and str object are usually converted to each other.

>>> "".encode('u8')
b'\xe4\xb8\xad\xe6\x96\x87'
>>> b'\xe4\xb8\xad\xe6\x96\x87'.decode('u8')
''

a2b_hex converts string fingers into hexadecimal bytecodes, which is commonly used in serial communication. A2B and B2B methods are inverted to each other, and you can see by yourself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e49ad6-2728f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e49ad6-2728f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?