this not work well:
a = ['123','567','10', '223', '33']
for item in a:
if ('5' or '1' or '2') in item:
print(item)
I want to get any item in which there is at least one match with the numbers 1 or 2 or 5
My version is very cumbersome:
if '5' in item or '1' in item or '2' in item:
>Solution :
You can use any,
a = ['123','567','10', '223']
for item in a:
if any(i in item for i in ('5','1','2')):
print(item)