[Python] Filter a dictionary with a list of strings

Discussão em 'Python' iniciado por Stack, Maio 20, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dictionary where every key and every value is unique. I'd like to be able to filter based on a list of strings. I've seen lot of examples with the key is consistent but not where its unique like in the example below.

    thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964}
    filt = ["rand", "ar"]


    result

    {"brand": "Ford","year": 1964}

    Continue reading...

Compartilhe esta Página