I have a list of float numbers, its format is:
float_list = [1.13, 0.25, 3.28, ....]
I used following code to write it to a .csv file:
float_str = ""
for result in result_list:
float_str = float_str + str(result.get_value()) + ","
with open(output_path, "wb") as file:
writer = csv.writer(file)
writer.writerow(float_str)
file.close()
where result.get_value() is:
def get_value():
return float(value)
I expect to see that in each cell, there is a value. However, what I've got looks like:
1 . 1 3 , 0 . 2 5 , 3 . 2 8 ,
It seems that each of the digits occupies a cell.
So, may I know how can I solve this issue and get what I expected?