compare dictionaries

Paul Rubin no.email at nospam.invalid
Tue Sep 7 22:06:01 CEST 2010


Baba <raoulbia at gmail.com> writes:
> word= 'even'
> dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
>
> i want to know if word is entirely composed of letters in dict2

set(word) <= set(dict2.keys())



More information about the Python-list mailing list