menyimpan data dalam python

replicate = 5

with open("output_data" + str(replicate) + ".csv", "w") as out_file:
    for i in range(len(fitness_list)):
        out_string = ""
        out_string += str(fitness_list[i])
        out_string += "," + str(trait1_list[i])
        out_string += "," + str(trait2_list[i])
        out_string += "\n"
        out_file.write(out_string)
Angry Ant