Message332810
| Author | eorochena |
|---|---|
| Recipients | eorochena |
| Date | 2018-12-31.10:53:23 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1546253603.09.0.372827657102.issue35626@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
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 |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-12-31 10:53:26 | eorochena | set | recipients: + eorochena |
| 2018-12-31 10:53:23 | eorochena | set | messageid: <1546253603.09.0.372827657102.issue35626@roundup.psfhosted.org> |
| 2018-12-31 10:53:23 | eorochena | link | issue35626 messages |
| 2018-12-31 10:53:23 | eorochena | create | |