from numpy import arange fitness_list = arange(1, 50, 2) trait1_list = arange(0, 250, 10) trait2_list = arange(150, 0, -6) 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) !ls output_*