Getting values out of a CSV

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jul 13 01:51:25 EDT 2007


En Fri, 13 Jul 2007 02:10:17 -0300, Daniel <no at no.no> escribió:

> data = [row for row in csv.reader(open('some.csv', 'rb'))

Note that every time you see [x for x in ...] with no condition, you can  
write list(...) instead - more clear, and faster.

data = list(csv.reader(open('some.csv', 'rb')))

-- 
Gabriel Genellina




More information about the Python-list mailing list