首页 > 其他 > 详细

对Quene中的队列的状态进行操作

时间:2019-12-04 20:29:40      阅读:88      评论:0      收藏:0      [点我收藏+]

查看队列的状态(包括队列的满状态、空、元素个数等等)

 1 import multiprocessing
 2 
 3 quene = multiprocessing.Queue(3)
 4 quene.put(12)
 5 quene.put("hello")
 6 quene.put("world")
 7 
 8 # 1.判断队列是否是满状态
 9 isFull = quene.full()
10 print("isFull---->",isFull)
11 # 2.判断队列中元素的个数
12 print("quene中的元素个数:",quene.qsize())
13 # 3.判断队列是否为空
14 value = quene.get()
15 value = quene.get()
16 value = quene.get()
17 
18 isEmpty = quene.empty()
19 print("isEmpty---->",isEmpty)

 

对Quene中的队列的状态进行操作

原文:https://www.cnblogs.com/liuxjie/p/11984907.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!