I need to write into a csv file using python and each iterator item should start in a new line. So delimiter I am using is \"\\n\". After each list has been written,next lis
first transpose your input by using zip()
>>> zip(*lol)
[(1, 4), (2, 5), (3, 6)]
and after that just pass it to csw.writer
e.g.
with open("test.csv", "wb") as f:
fileWriter = csv.writer(f, delimiter=',',quotechar='|', quoting=csv.QUOTE_MINIMAL)
for row in zip(*lol):
fileWriter.writerow(row)
... which results to:
$ cat test.csv
1,4
2,5
3,6