I want to write a list of lists into a csv file. Each element of a list should go into a new column and each list should have its own row. I can`t figure out how to insert each element of a list to a new column. My code looks like this:
example_list = [[1,2,3], [4,5,6], [7,8,9]]
with open('example.csv', 'w') as f:
writer = csv.writer(f)
for line in example_list:
writer.writerow(line)
But this will give me a file with each list in a single column. Can anybody give me a hint how to seperate the list elements?