mikeckennedy / python-jumpstart-course-demos

Contains all the "handout" materials for my Python Jumpstart by Building 10 Apps course. This includes try it yourself and finished versions of the 10 apps.
https://talkpython.fm/course
MIT License
746 stars 536 forks source link

csv.DictReader returns OrderedDict in 3.6 #28

Closed DWSimmons closed 7 years ago

DWSimmons commented 7 years ago

Issue: Possible confusion going forward of output of csv.Dict for versions of 3.6+ as output does not match presentation

App9 "CSV Processing with the CSV module" uses csv.DictReader and the output is shown as

<class 'dict'> {'street': '3526 HIGH ST', and talked as such. While using 3.6.2 csv.DictReader returns <class 'collections.OrderedDict'> OrderedDict([

I looked at CSV sourcecode for 3.5.2 line 118 - d = dict(zip(self.fieldnames, row)) and for csv.DictReader sourecode for 3.6.2 line 120 - d = OrderedDict(zip(self.fieldnames, row))

mikeckennedy commented 7 years ago

Thanks for reporting this @DWSimmons

I just posted an updated video with a note about the new return type. You probably have to clear your browser cache or do a hard refresh to see the new content but will help in a pay it forward style. :)