On Dec 11, 2:14 pm, "massimo s." <[EMAIL PROTECTED]> wrote:
> dislike more is that it seems working by *rows* instead than by
> *columns*.
you can easily transpose the data to get your columns, for a data file
that looks like this:
---- data.txt ----
A,B,C
1,2,3
10,20,30
100,200,300
do the following:
--------------------
import csv
reader = csv.reader( file('data.txt', 'U') )
rows = list(reader)
print rows
cols = zip(*rows)
print cols[0]
print cols[1]
print cols[2]
this will print:
---------- Python ----------
[['A', 'B', 'C'], ['1', '2', '3'], ['10', '20', '30'], ['100', '200',
'300']]
('A', '1', '10', '100')
('B', '2', '20', '200')
('C', '3', '30', '300')
--
http://mail.python.org/mailman/listinfo/python-list