compare dictionaries

Paul Rubin no.email at nospam.invalid
Tue Sep 7 16:06:01 EDT 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