Skip to content
Advertisement

Tag: list-comprehension

How to find the values of a key in a nested list of dictionaries in Python

This is my data structure. I have 3000 instances of ‘product’ within the ‘clothes list’. Each contains another list of dictionaries that stores the reviews. I am attempting to iterate through all the reviews in the dictionary and return all the reviews written by a particular username. My Two attempts below output the same error. The Error TypeError: list indices

Advertisement