I would like to have a persistant queue in python that I can cycle through, but only remove items if a particular condition is met.
I have seen the persist-queue package, but queue.get() removes the item without allowing checks first. Does anyone know of a package/approach to do this (other than using persist-queue and adding items back onto the queue if the condition isn't met).
So for example:
I have a queue containing the following items:
[1,2,37,8,9,3,10,22]
while not queue.empty:
item = queue.get()
if item % 3 ==0:
remove item from queue
should leave the queue with the following items:
[1,2,37,8,10,22]