According to your usage example, you really want zip() :
In this example, note that csv.reader() basically splits the file into form data:
[ ["a1", "b1", "c1", "d1"], ["a2", "b2", "c2", "d2"], ..., ["an", "bn", "cn", "dn"] ]
Example:
table = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], ]
Now you have the columns variable of the form:
columns = [ [1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12] ]
Ok, so apply this to the csv file:
with open("mycsv.csv", "rb") as infile: reader = csv.reader(infile, delimiter=";") next(reader, None)
What is it!
Note. In this example, we assume that "mycsv.csv" has the correct number of columns in each row. You may need to perform a check to make sure that all lines are "full".