[New-bugs-announce] [issue35626] Python dictreader KeyError issue
Eduardo Orochena
report at bugs.python.org
Mon Dec 31 05:53:23 EST 2018
New submission from Eduardo Orochena <mint.alchemist at gmail.com>:
def load_file(filename):
with open(filename, 'r', encoding='utf-8') as fin:
header = fin.readline()
print('Found ' + header)
reader = csv.DictReader(fin)
for row in reader:
print(type(row), row)
print('Beds {} '.format(row['beds']))
This results in a KeyError exception
whilst
open_f = open(filename, 'r', encoding='utf-8')
read_it = csv.DictReader(open_f)
for i in read_it:
print('Beds {}'.format(i['beds']))
behaves as expected
----------
components: Build
messages: 332810
nosy: eorochena
priority: normal
severity: normal
status: open
title: Python dictreader KeyError issue
type: crash
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35626>
_______________________________________
More information about the New-bugs-announce
mailing list