I have a (main) list of objects 'feedbacks' which have an 'order_id' and a 'message'. I have another list of simply 'order_id's whose correspondent object in the main list I would like to see removed.
main list: [object type 'feedback', object type 'feedback', object type 'feedback']
let's assume the orders id were '123', '456, '789'.
Result: [object type 'feedback'] whose order_id would be '456'.
I would also like to be able to do the opposite.
Considering the same main list as before, if I had a include_list:
Result: [object type 'feedback', object type 'feedback'] whose order_ids would be '123' and '456'
I hope I have been clear enough. If I haven't just let me know and I will try to better explain myself.
I am aware that this is quite simple but I am not being able to do it successfully.
Here's the code I have for this, that isn't working:
for feedback in feedbacks: if feedback.order_id in orders_excluded: # if a feedback order id is in the exclude list file feedbacks.remove(feedback) # erase it
For some unknown reason this piece of code is not removing all entries as it should.
Any help on this would be greatly appreciated.