I am adding data in priority queue in the form of (priority,data) but when I use the function get(), I get back my priority instead of data. Also, if I add in the form of (data,priority), it is sorted by data values.
here is my trial code
from Queue import PriorityQueue
q= PriorityQueue(0)
q.put(4,8)
q.put(3,7)
q.put(2,6)
q.put(1,5)
while not q.empty():
item = q.get()[1]
print item,
print
q= PriorityQueue(0)
q.put(4,5)
q.put(3,6)
q.put(2,7)
q.put(1,8)
while not q.empty():
item = q.get()[1]
print item,
print
first one is giving error TypeError: 'int' object is not iterable and second one TypeError: 'int' object has no attribute 'getitem'