[Python-ideas] csv.DictReader could handle headers more intelligently.

Serhiy Storchaka storchaka at gmail.com
Fri Jan 25 11:01:08 CET 2013


On 25.01.13 03:49, alex23 wrote:
> On 25 Jan, 06:35, Serhiy Storchaka <storch... at gmail.com> wrote:
>> csvreader = DictReader(l for l in csvfile if l.strip())
>
> Uh, thanks, although I'm not sure what you think you're showing me
> that I'm not already aware of. I spelled it out as two separate
> expressions for clarity, I didn't realise we were playing code golf in
> our examples.

I point that you no need to read all file in a memory. You can use an 
iterator and process it line by line.





More information about the Python-ideas mailing list