I have a list:
bigdumblist = [
(0, 0, {'product_id': 2, 'product_uom_qty': 90}),
(0, 0, {'product_id': 3, 'product_uom_qty': 5}),
(0, 0, {'product_id': 5, 'product_uom_qty': 69})
]
I want to remove all items from the list where 'product_id'
is not 2 or 3, like so:
[
(0, 0, {'product_id': 2, 'product_uom_qty': 90}),
(0, 0, {'product_id': 3, 'product_uom_qty': 5})
]
What I have tried:
def not_in(item):
if item["product_id"] is not 2 or 3:
bigdumblist.remove((0, 0, {'product_id': 5, 'product_uom_qty': 69}))
for _, _, item in bigdumblist:
not_in(item)
break
print(bigdumblist)
Which works but obviously including (0, 0, {'product_id': 5, 'product_uom_qty': 69})
is not a solution. How can I properly remove specific items in the list?