Python Forum

Full Version: 2 or more data to be written in a row
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A. I am using f.write(str(data1)) to save some data but I am limited to just 1 data per row. How can I save data1, data2, data3, ... in a row?

B. Any other way to save numeric data without having to use str?

Thanks.

P/S Just found a way to write in a row, using csv.
Managed to write 2 or more data in a row using csv. So closing this.

If there are other ways to do, please let me know. Thanks.
If you're using arrays (1D/2D), you can use numpy.savetxt to have a cvs like file
Also I don't understand how using f.write() prevents you from writing more than one value in a row.