Hi
I want to write some variables into a file to be readable by excel. I used a loop like this to write the calculated "x" variable into the file. It works but the problem is that I get all the numbers in one line. I'm wondering how can I get numbers in seperate lines.
Here is the code:
---------------------------------------------------------------------------
data1 = []
x_org = []
locx = open('C:\Temp\Loc', 'w')
for i in range(9):
data1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
x_org.append(data1)
x = str(x_org)
locx.writelines(x)
locx.close()
----------------------------------------------------------------------------
When you run this code, you get "123456789" in the Loc file. But I need the numbers in seperate lines, like:
1
2
3
4
5
6
7
8
9
Thanks
Nima