Message70311
Like Raymond, I have issues with the idea of implicitly reading the
headers in __init__, but would be fine with the idea of a separate
method in 2.7/3.1.
As far as working around the absence of such a method goes, I personally
use itertools.chain if I happen to need the headers before I start
iterating:
r = csv.DictReader(open('test.csv'))
first = next(r)
# Do something with r.fieldnames
for row in chain(first, r):
# Do something with each row |
|
Date |
User |
Action |
Args |
2008-07-27 04:15:48 | ncoghlan | set | recipients:
+ ncoghlan, skip.montanaro, rhettinger, mishok13 |
2008-07-27 04:15:48 | ncoghlan | set | messageid: <1217132148.42.0.233271510487.issue3436@psf.upfronthosting.co.za> |
2008-07-27 04:15:47 | ncoghlan | link | issue3436 messages |
2008-07-27 04:15:47 | ncoghlan | create | |
|