My writer function looks like:
with open(filename, "w") as file:
file.truncate(0)
writer = csv.writer(file)
writer.writerows(input_list)
My input_list
looks like:
[[10.0, 11.0, 20.0, 20.0, 0.8], [40.0, 42.0, 20.0, 20.0, 0.6]]
My output csv file looks like:
10.0,11.0,20.0,20.0,0.8
40.0,42.0,20.0,20.0,0.6
I want it to look like:
10, 11, 20, 20, 0.8
40, 42, 20, 20, 0.6
I would like the formatting of the spaces after the numbers themselves. While I could add something within the program to create a space between the elements and check for whether the number is less than 1, before casting it to an int
(numbers above 1 cannot be floats), I would like to look for a more pythonic and elegant solution.