Q:

Python: write list to csv, transposing the first row into a column

Using python, I have data stored in a list:
a = [['a', 'b', 'c'], [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]

I want to write this list to a csv that looks like the following:
a, 1, 2, 3, 4
b, 5, 6, 7, 8
c, 9, 10, 11, 12

This is the code I came up with after reading lots of other transposing problems:
length = len(a[0])
with open('test.csv', 'w') as test_file:
    file_writer = csv.writer(test_file)
    for i in range(length):
        file_writer.writerow([x[i] for x in a])

Which gives me:
a,1,5,9
b,2,6,10
c,3,7,11

So it transposes the entire list (not to mention that some values even get lose), but as shown above, I only want the first row to be transposed.  I just don't know where to even get my hand on. 
Thanks to Nf4r, I came up with the following -- may look awkward, but works :-)
a = [['a', 'b', 'c'], [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
f = open('test.csv', 'a')
for header, data in zip(a[0], a[1:]):
    result = "{header}, {data}".format(header = header,
                               data = ', '.join((str(n) for n in data)))
    f.write(result)
    f.write('\n')
f.close()

A:

You just need to pull the first sublist and zip with the remainder then use writerows after combining into a single list:
a = [['a', 'b', 'c'], [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
import csv

with open('test.csv', 'w') as test_file:
    file_writer = csv.writer(test_file)
    it = iter(a)
    col_1 = next(it)
    file_writer.writerows([a] + b for a,b in zip(col_1, it))

