The problem is the following, for instance:
lst = ['2456', '1871', '187']
d = {
'1871': '1',
'2456': '0',
}
for i in lst:
if any(i in x for x in d.keys()):
print i
% python test.py
2456
1871
187
So, I need to get all the elements from the list "lst" that are contained in the keys of dictionary "d", without a substring match, cause if I do "print d[i]", I get an error.