1. 替换空格
>>> toSend = "FF F9 FF 00 00 FA FF F7 FF F4 FF F6 FF F7 FF F6 FF FD FF 05 00 03 00 06 00 05 00 04 00 06 00 06 00"
>>> toSend.replace(' ', '').decode('hex')
'\xff\xf9\xff\x00\x00\xfa\xff\xf7\xff\xf4\xff\xf6\xff\xf7\xff\xf6\xff\xfd\xff\x05\x00\x03\x00\x06\x00\x05\x00\x04\x00\x06\x00\x06\x00'
>>>
2. 替换空格
>>> toSend = "FF F9 FF 00 00 FA FF F7 FF F4 FF F6 FF F7 FF F6 FF FD FF 05 00 03 00 06 00 05 00"
>>> ' '.join([x.decode('hex') for x in toSend.split()])
'\xff \xf9 \xff \x00 \x00 \xfa \xff \xf7 \xff \xf4 \xff \xf6 \xff \xf7 \xff \xf6 \xff \xfd \xff \x05 \x00 \x03 \x00 \x06 \x00 \x05 \x00'