Read CSV file into an array

Tobiah toby at tobiah.org
Wed Jan 10 21:09:43 CET 2007


oyekomova wrote:
> I would like to know how to read a CSV file with a header ( n columns
> of float data) into an array without the header row.
> 
import csv

l = []
for line in csv.reader(open("my.csv").readlines()[1:]):
         l.append(line)

Which really gets you a list of lists.

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list