diff options
author | Raymond Hettinger <python@rcn.com> | 2016-08-30 19:35:50 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-08-30 19:35:50 (GMT) |
commit | 43ca4528873b8d0bc8c9e63b3871f4fe4286259c (patch) | |
tree | 1b2f178f1b92934b39ac82a7279c4634a9d87c83 /Lib/csv.py | |
parent | 15f44ab043b37c064d6891c7864205fed9fb0dd1 (diff) | |
download | cpython-43ca4528873b8d0bc8c9e63b3871f4fe4286259c.zip cpython-43ca4528873b8d0bc8c9e63b3871f4fe4286259c.tar.gz cpython-43ca4528873b8d0bc8c9e63b3871f4fe4286259c.tar.bz2 |
Issue #27842: The csv.DictReader now returns rows of type OrderedDict.
Diffstat (limited to 'Lib/csv.py')
-rw-r--r-- | Lib/csv.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -11,6 +11,7 @@ from _csv import Error, __version__, writer, reader, register_dialect, \ __doc__ from _csv import Dialect as _Dialect +from collections import OrderedDict from io import StringIO __all__ = ["QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE", @@ -116,7 +117,7 @@ class DictReader: # values while row == []: row = next(self.reader) - d = dict(zip(self.fieldnames, row)) + d = OrderedDict(zip(self.fieldnames, row)) lf = len(self.fieldnames) lr = len(row) if lf < lr: |