Imagine that I have a list like this :
list1 = [12.34, 17.68, 19.22]
Now I want to write each numbers in one row of a CSV file. So after that I changed the type of numbers to string, I do this :
with open(output_file_name, 'w') as ofile:
outfile = csv.writer(ofile)
outfile.writerows(list1)
and the result will be something like this :
1,2,.,3,4
1,7,.,6,8
1,9,.,2,2
How can I delete these commas between the numbers?
Note :
- I want to show each number in a row
- I don't want anything for delimiter.
- I use Python 3.9.7
- I know that .csv file might not be suitable for this case, but this is a project that somebody wants from me, as an exam !
delimiterto see all the ways to set this.