This function works by iterating over the input string in steps of 2, converting each pair of hexadecimal characters to decimal using int(..., 16), and appending the result to the data_list.
Below is a simple Python function that takes a string in hexadecimal format and translates it into byte data.
def string_to_data(data_string):
# Check if the length of the string is even
if len(data_string) % 2 != 0:
raise ValueError("Input string length must be even")
# Convert each pair of hexadecimal characters to decimal and create a list
data_list = [int(data_string[i:i+2], 16) for i in range(0, len(data_string), 2)]
return data_list