Skip Montanaro wrote:

Assuming the header line has descriptive titles, I prefer the DictReader
class.  Unfortunately, it requires you to specify the titles in its
constructor.  My usual idiom is the following:

I deal so much with tab-delimited CSV files that I found it useful to create a subclass of csv.DictReader to deal with this, so I can just write:


for row in tabdelim.DictReader(file(filename)):
    ...

I think this is a lot easier than trying to remember this cumbersome idiom every single time.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to