data = [
[
{'name': 'gan', 'age': 21}, {'name': 'esh', 'age': 22}
],
[
{'name': 'rahul', 'age': 23}, {'name': 'rohan', 'age': 24}
]
]
u_names = [data['name'] for i in data for j in i if data['age'] > 21]
print(u_names)
line 38, in <module>
if data['age'] > 21:
TypeError: list indices must be integers or slices, not str
Я получаю эту ошибку, в чем причина.