Spaces:
Running
Running
File size: 285 Bytes
751936e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from queue import Queue
q = Queue(maxsize=0)
#写入队列数据
q.put(0)
q.put(1)
q.put(2)
#输出当前队列所有数据
print(q.queue)
#删除队列数据,并返回该数据
q.get()
#输也所有队列数据
print(q.queue)
for i in range(10):
print(q.get(), q.qsize())
|