I am trying to loop through a Queue from the queue
module in python, I dont want to empty the queue, I dont know how. This is my code.
from queue import Queue
q = Queue()
q.put(3)
q.put(5)
q.put(7)
for element in q:
print(element)
How can I do this?
The error messange is:
TypeError: 'Queue' object is not iterable
I want to use Queue, because Im using it for BFS. I cant empty the Queue.