I need to be able to find an item in a list (an item in this case being a dict) based on some value inside that dict. The structure o
I used this, since my colleagues are probably more able to understand what's going on when I do this compared to some other solutions provided here:
[item for item in item_list if item['id'] == my_unique_id][0]
And since it's used in a test, I think the extra memory usage isn't too big of a deal (but please correct me if I am wrong). There's only 8 items in the list in my case.