CSV module, DictReader problem (bug?)
Jeff Blaine
jblaine at mitre.org
Wed Nov 1 15:39:04 EST 2006
It's been a year or so since I written Python code, so maybe
I am just doing something really dumb, but...
Documentation
=============
class DictReader(csvfile[,fieldnames=None,
[,restkey=None[, restval=None[, dialect='excel'
[, *args, **kwds]]]]])
Create an object which operates like a regular reader
but maps the information read into a dict whose keys
are given by the optional fieldnames parameter. If the
fieldnames parameter is omitted, the values in the
first row of the csvfile will be used as the fieldnames.
Code
====
import csv
r = csv.DictReader('C:\Temp\Book1.csv')
print r.next()
# EOF
Output
======
{'C': ':'}
More information about the Python-list
mailing list