Здравствуйте, я бы хотел получить все значения типа "Integer" из dict:
array_test = [{ "result1" : "date1", "type" : "Integer"},{ "result1" : "date2", "type" : "null"}]
Я пытался:
test = {'result1':array_test['result1'] for element in array_test if array_test['type'] == "Integer"}
Однако я получил эту ошибку:
>>> test = {'result1':array_test['result1'] for element in array_test if array_test['type'] == "Integer"}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <dictcomp>
TypeError: list indices must be integers or slices, not str
>>>
>>>
Поэтому я хотел бы поблагодарить за поддержку для достижения следующего результата
test = [{ "result1" : "date1", "type" : "Integer"}]