with open('testDat.txt', 'r') as f:
    data = f.readlines()

result = [] 

for line in data:
    data_bit = line[1:-1] 
    data_int = int(data_bit, 16) 
    data_str = format(data_int, '0>2X') 

    result.append(data_str) 

    if len(result) == 16:
        with open('testDat_format.txt', 'a') as f:
            f.write(','.join(result) + '\n')
        result.clear()

if result:
    with open('testDat_format.txt', 'a') as f:
        f.write(','.join(result) + '\n')
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence