On Tue, Nov 17, 2009 at 1:57 PM,  <m...@doctors.net.uk> wrote:

> A rather general question, I'm afraid. I have found myself writing some 
> python code to handle some CSV data, using the csv. DictReader that generates 
> a dict for each row with the key as the column heading and the value in the 
> file as the item. Most operations involve code of the form: (Apologies for 
> incorrect caps)
>
> For row in reader:
>    If row['foo'] == 'something' :
>        do this etc.

> My other question was about how I do this more efficiently: I don't want to 
> read the whole thing into memory at once, but (AFAIK) csv.DictReader doesn't 
> support something like readline() to deliver it one at a time.

The loop above does deliver one line worth of data at a time.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to