The context doesn't matter too much, but I came across the problem that while trying to pop dict
objects from a list
, it wouldn't delete all of them. I'm doing this to filter for certain values in the dict
objects, and I was left with things that should have been removed. Just to see what would happen, I tried deleting every item in the list
called accepted_auctions
(shown below), but it did not work.
for auction in accepted_auctions:
accepted_auctions.pop(accepted_auctions.index(auction))
print(len(accepted_auctions))
When I tested this code, print(len(accepted_auctions))
printed 44
into the console.
What am I doing wrong?