Aug-12-2021, 07:16 AM
Will this help?
def CutData(FullData, StartByte, length=1): StartByte = StartByte - 1 EndByte = StartByte + length print(f'full data is {FullData}' + str(type(FullData))) Data_Byte = FullData.split(' ') print(f'Full Data_Byte is {Data_Byte}' + str(type(Data_Byte)) Wanted_Data = str(Data_Byte[StartByte:EndByte]) print(type(Wanted_Data)) return Wanted_Data Test= (CutData(Data, 5, 1)) print (str(type(Test)) + " " + Test) y = str(Test) print(y)
full data is 74 a9 60 7e a9 ff 02 00<class 'str'> Full Data_Byte is ['74', 'a9', '60', '7e', 'a9', 'ff', '02', '00']<class 'list'> <class 'str'> <class 'str'> ['a9']