DictReader parses CSV records into dictionaries. The first row supplies field names, so each later row can be accessed by names such as code and icon instead of column positions. Converting the reader to a list makes the parsed records available for inspection or later use. section 11.3.1
>>> pprint(items)
[{'code': 'grapes', 'icon': ':grapes:'},
{'code': 'carrots', 'icon': ':carrot:'},
{'code': 'candy', 'icon': ':candy:'},
{'code': 'lollipop', 'icon': ':lollipop:'}]
A snack CSV headed code,icon becomes one dictionary per snack. Each dictionary maps code to its QR value and icon to its emoji short code. section 11.3.1
Load robot snack definitions
Read the CSV file, convert each emoji short code first, then pass the resulting lines to DictReader. The returned list can supply the robot's snack data while QR detection and motor functions handle movement separately. section 11.3.2 section 11.3.2
def get_items():
lines = [emojize(i) for i in open(ITEMS_FILE)]
return list(DictReader(lines))
This reusable function prepares every CSV line with emojize and returns the DictReader result as a list of item dictionaries. section 11.3.2

