import csv
a=[]
with open('large.csv','w') as f1:
writer=csv.writer(f1, delimiter='\t',lineterminator='\n',)
for i in range(1000000):
for j in range(i+1):
a.append(i+j*0.2)
#print i,j,a
#want to write into same csv file???
'''like
0 1 2......999999
0 0.0
1 1.0 1.2
2 2.0 2.2 2.4
. .....
. .....
999999
'''
a=[]
I have done this to avoid same caculation twice and as the list ‘a’ will grow large I have to initialize it again(after one iteration of the outer loop) .So, I want the list(before get initialized again) written into csv file in the above manner but I am not able to do so……please help.
Do you want to do something like this?
or also with the row/column headers:
The latter returns the following file (I have replaced 1000000 with 10):