I have a look which looks like the following:
yyy=[(2.0, 3.4, 3.75), (2.0, 3.4, 0.0), (2.0, 3.4, 0.0), (2.0, 3.4, 3.5), (2.0, 3.4, 0.0)]
What I would like to do is identify if 0.0 is present in any of the sublists (true or false). So, I follow itertools, but I am unsure how the logic should be constructed.
from itertools import *
selectors = [x is 0 for x in yyy]
#[False, False, False, False, False]
Obviously, my above sytax does not seem right - I was wondering if someone could point me in the right direction for the syntax.
Try [0.0 in x for x in yyy]
>>> yyy=[(2.0, 3.4, 3.75), (2.0, 3.4, 0.0), (2.0, 3.4, 0.0), (2.0, 3.4, 3.5), (2.0, 3.4, 0.0)]
>>> [0.0 in x for x in yyy]
[False, True, True, False, True]
>>>
You were close.