I have 2 lists of objects:
For example:
class Object1:
def __init__(self, id):
self.id = id
Object1List = []
Object1List.append(Object1("id", 1))
Object1List.append(Object1("id", 2))
Object1List.append(Object1("id", 3))
class Object2:
def __init__(self, id):
self.id = id
Object2List = []
Object2List.append(Object2("id", 3))
Object2List.append(Object2("id", 4))
Object2List.append(Object2("id", 5))
Object2List.append(Object2("id", 6))
How do I remove any objects from Object1List
with the same id
as one in Object2List
?