进程的队列
from multiprocessing import Process,Queue #和JoinableQueue类似,但是JoinableQueue多了task_list 和join两个方法
qq = Queue(3)
qq.put('first',block=False,timeout=7)
qq.put('second',block=False,timeout=7)
qq.put('third',block=False,timeout=7)
# # qq.put('second',block=True)
# # qq.put('thirt',block=True)
# # qq.put('forte',block=False)
# # qq.put_nowait('second')
# # qq.put_nowait('third')
# # qq.put_nowait('forth') #block = True ====>默认的参数,超过范围不报错,会卡主,当为False则卡主,报错,timeout为卡主的时间
# # print(qq.get()) #拿出来
# print(type(qq))
# for i in range(1,4):
# print(i,qq.get()) print(qq.get()) print(qq.get()) print(qq.get())
这个代码被我修改乱了,抱歉
本文来自博客园,作者:一石数字欠我15w!!!,转载请注明原文链接:https://www.cnblogs.com/52-qq/p/7428846.html