mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Issue #27842: The csv.DictReader now returns rows of type OrderedDict.
This commit is contained in:
parent
15f44ab043
commit
43ca452887
4 changed files with 45 additions and 16 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue