csvreader.fieldnames not recognized as an attribute of a csv reader object in python
If you truly want to use csv.reader instead of csv.DictReader, all you need to do is replace
reader.next() # read next line so header will be accessed
rfd_header = reader.fieldnames
by
rfd_header = reader.next()
Try csv.DictReader
instead of csv.reader
. The documentation says it too:
DictReader objects have the following public attribute:
csvreader.fieldnames - If not passed as a parameter when creating the object, this attribute is initialized upon first access or when the first record is read from the file.
http://docs.python.org/library/csv.html