1 #创建队列 2 import queue 3 q=queue.Queue(maxsize=10) 4 for i in range(10): 5 q.put(i) #往队列里面放值 6 7 while not q.empty(): #当q不为空的时 8 print(q.get()) #取出q的值 9 a=2 10 11 while a==1: 12 print("ok") 13 else: 14 print("不OK")