I Think this should work but its giving me an error. I have a list that contains objects of class node. I have two different lists
node
In response to your followup, yes in will check for membership in a list, so:
in
if removed in node_list: node_list.remove(removed)
will not give you the error. Alternatively, you could trap the error:
try: node_list.remove(removed) except ValueError: pass