[Python-ideas] csv.DictReader could handle headers more intelligently. (original) (raw)
Mark Hackett mark.hackett at metoffice.gov.uk
Tue Jan 29 12:39:28 CET 2013
- Previous message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Next message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tuesday 29 Jan 2013, Alexandre Zani wrote:
As for a MultiDictReader, I don't think this is superior to csv.reader. In both cases, you need to keep track of the column orders. And if you already know the column order, you might as well just manually specify the field names in DictReader.
But it would allow you to access the index by name.
value=csv_array[indecies{"Total Cost"}]
A little more verbose than
value=csv_dict{"Total Cost"}
But it's easier to read what it's doing than
value=csv_array[3]
- Previous message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Next message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]