Sep-26-2017, 07:22 PM
just to make sure you understand:
1.y is a dict
2. y['_items'] is a list of dicts, so I don't know how many elements it has, so we must iterate. of course you can access elements by index like you did y['_items'][0] but you don't know if there are more elements...
3. each of the dicts (item) that we iterate over in step 2 has again an element with key '_items' which is again list of dicts.
4. we iterate over these (item2)
5. each item2 is a dict that has element with key 'volumes' which is a list of dicts
6. we iterate over these lists (volume) and extract element with key 'size'
1.y is a dict
2. y['_items'] is a list of dicts, so I don't know how many elements it has, so we must iterate. of course you can access elements by index like you did y['_items'][0] but you don't know if there are more elements...
3. each of the dicts (item) that we iterate over in step 2 has again an element with key '_items' which is again list of dicts.
4. we iterate over these (item2)
5. each item2 is a dict that has element with key 'volumes' which is a list of dicts
6. we iterate over these lists (volume) and extract element with key 'size'