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 list should write from next cell. like below:
lol = [[1,2,3],[4,5,6]]
The csv will be like:
1 4
2 5
3 6
What I have tried:
file = open("test.csv", "wb")
fileWriter = csv.writer(file , delimiter='\n',quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamWriter.writerow([1,2,3])
spamWriter = csv.writer(file , delimiter=',',quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamWriter.writerow([4,5,6])
file.close()
Which results like below:
1
2
3
4 5 6
Using csv module how can I get output like below:
1 4
2 5
3 6
here space means comma in a csv file.
Thanks.