I am looking for a simple thing if an object exists in a Python Queue
eg
queue = Queue.Queue()
queue.put(1)
queue.put(2)
queue.put(3)
queue.put(4)
if 3 in queue:
print "yes"
I am getting Error;
Traceback (most recent call last):
File "", line 1, in
TypeError: argument of type 'instance' is not iterable
I am new to Python but I know its easy to handle this in Java.
Queue<Integer> q = new LinkedList<>();
//here is the method
q.contains(obj)
I couldn't get any solution to handle this case and I need this in one of my Python problems. I would really appreciate, if some one could help.
-Krishna