[Python] check if element exists in priorityQueue of tuples

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    Say I have this code:

    q = PriorityQueue()
    a = ((1,1), 10, 0)
    b = ((2,2), 99, 200)
    q.put(a)
    q.put(b)


    I'd like to check if the element (1, 1) exists in any of the tuples in the queue. Is there a way to do this?

    Continue reading...

Compartilhe esta Página