I am looking to check if a node already exists in my list, by an attribute of the node. Such as the following which isn't working:
if node.num not in [x.num for x in list]:
print(node)
If list has an x
such that x.num == 3
and also node.num == 3
, I don't want to print node.
Comments
Post a Comment