You almost never need to use dict.keys().

dct = {"12345": 6, "01928": 7} lst = [1, 2, 3, 12, 34, 234] print("\n".join(key for key in dct if all(str(i) in key for i in lst)))