[Tutor] creating a tab delimited filename
jrlen balane
nbbalane at gmail.com
Tue Mar 15 04:35:02 CET 2005
so for example, i have 5 arrays, i can do this (is this correct):
data1[1,2,3,4,5 (and so on)]
data2[1,2,3,4,5 (and so on)]
data3[1,2,3,4,5 (and so on)]
data4[1,2,3,4,5 (and so on)]
data5[1,2,3,4,5 (and so on)]
datas = [data1, data2, data3, data4, data5]
for data in datas:
lines.append('\t'.join(data) + '\n')
=================================
(supposed to be output)
1 2 3 4 5 ...
1 2 3 4 5 ...
1 2 3 4 5 ...
...
(but i want this output)
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
... ... ... ... ...
=================================
output_file = file('c:/output.txt', 'w')
output_file.writelines(lines)
output_file.close()
=================================
how am i going to change the filename automaticaly?
for example:
#every 5 minutes, i am going to create a file based on the data above
for i in range(100)
output_file = file('c:/output' +.join(i) +'.txt', 'w')
#guess this won't work
output_file.writelines(lines)
output_file.close()
More information about the Tutor
mailing list