Apr-19-2019, 08:32 AM
Ok, but how do I get 'Vancouver, US' and Vancouver, CA' as expected?
I changed the line
I changed the line
cities = ["{} ({})".format(d['name'], d['sys']['country']) for d in data['list']]
to cities = ["{} ({})".format(d['name'], d['sys']['country']) for d in list['data']]
thinking that perhaps it was a typo in the book. The result was:cities = ["{} ({})".format(d['name'], d['sys']['country']) for d in list['data']] TypeError: 'type' object is not subscriptable