Getting values out of a CSV

Daniel no at no.no
Fri Jul 13 02:43:58 EDT 2007


On Fri, 13 Jul 2007 08:51:25 +0300, Gabriel Genellina  
<gagsl-py2 at yahoo.com.ar> wrote:
>> 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')))

Clearer? Maybe, but list comprehensions are clearer (at least for me)

Faster? No. List Comprehensions are faster.



More information about the Python-list mailing list