Reading a CSV file

Dan Stromberg drsalists at gmail.com
Tue Apr 23 17:49:47 EDT 2013


On Tue, Apr 23, 2013 at 2:39 PM, Ana Dionísio <anadionisio257 at gmail.com>wrote:

> Hello!
>
> I need to read a CSV file that has "n" rows and "m" columns and if a
> certain condition is met, for exameple n==200, it prints all the columns in
> that row. How can I do this? I tried to save all the data in a
> multi-dimensional array but I get this error:
>
> "ValueError: array is too big


Use:
csv.reader(*csvfile*, *dialect='excel'*,
***fmtparams*)¶<http://docs.python.org/2/library/csv.html#csv.reader>

This will allow you to iterate over the values, instead of reading them all
into memory at once.

csv.reader is documented at:

http://docs.python.org/3/library/csv.html

http://docs.python.org/2/library/csv.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130423/4e426b2d/attachment.html>


More information about the Python-list mailing list