Hmmm... Works for me. % python Python 2.7.6+ (2.7:db842f730432, May 9 2014, 23:53:26) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> with open("coconutBattery.csv", "rb") as f: ... r = csv.DictReader(f) ... x = r.fieldnames ... autoloading csv >>> x ['date', 'capacity', 'loadcycles']
(Ignore the "autoloading" message. I use an autoloader in interactive mode which comes in handy when I forget to import a module, as I did here.) It also works without assigning r.fieldnames to a new variable: >>> with open("coconutBattery.csv", "rb") as f: ... r = csv.DictReader(f) ... r.fieldnames ... ['date', 'capacity', 'loadcycles'] >>> r.fieldnames ['date', 'capacity', 'loadcycles'] I think you're going to have to paste another example session to show us what you might have done differently. Skip -- https://mail.python.org/mailman/listinfo/python-list