I want to write a csv file column by column using python. I read my data from a first csv file and, if the header is 'ok', then I want to copy the column. I tried the following:
for column in zip(*data):
l= []
if column[0] == 'ok' :
for k in column:
l.append(k)
my_writer.writerow(zip(*l))
But it raises the error:
wrt.writerow(zip(*l))
_csv.Error: sequence expected
I then tried with writerows instead of writerow, but the result is clearly not what I expect: The first column contains parts of the names of the headers...
Any idea?