Working:
def worker(): while True: fruit, colour = q.get() print 'A ' + fruit + ' is ' + colour q.task_done()
Entering elements into the queue:
fruit = 'banana' colour = 'yellow' q.put(fruit, colour)
Output:
>>> A banana is yellow
How can I achieve this? I tried and got ValueError: too many values to unpack , only then did I realize that my q.put() put both variables in the queue.
Is there a way to put a βsetβ of variables / objects in one element of the queue as I tried?
source share