[Python] How do I efficiently check if any value in a list of dictionaries matches a given...

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2025.

  1. Stack

    Stack Membro Participativo

    data = [
    {"id": 1, "name": "Alice", "active": True},
    {"id": 2, "name": "Bob", "active": False},
    {"id": 3, "name": "Charlie", "active": True},
    ]


    I want to check if any dictionary in the list has "active": True without looping manually using for.

    Is there a more Pythonic or efficient way to do this?

    Continue reading...

Compartilhe esta Página