a= [1,2,3,4]b = '2'
print [n for n in a if b in a]
[]
c = 2
print [n for n in a if c in a]
[1,2,3,4]
python 循环判断 先进行判断 在进行循环