Python Queue Module

queue module documentation

#! /usr/bin/python3
# ===================================================================
# PY Queue
# based on: www.youtube.com/watch?v=bnm5_GH04fM
#           Python Tutorial: Threading Beginners Tutorial - Queue
# ===================================================================

import queue

# ---- create a queue object

q = queue.Queue()              # FIFO queue (default queue)

# ---- put actions into the queue

q.put(5)
q.put('abc')

# ---- what is in the queue

while not q.empty():

    print('queue value: {q.get()}')