摘要: def consumer(): while True: x = yield print('处理了数据:',x) def producer(): c = consumer() next(c) for i in range(10): print('生产了数据:',i) c.send(i) produce... 阅读全文
posted @ 2018-09-11 16:01 Woowo 阅读(94) 评论(0) 推荐(0) 编辑
摘要: import time from concurrent.futures import ThreadPoolExecutor def func(n): time.sleep(2) print(n) return n*n tpool = ThreadPoolExecutor(max_workers=5) t_lst = [] for i in range(20): ... 阅读全文
posted @ 2018-09-11 09:37 Woowo 阅读(95) 评论(0) 推荐(0) 编辑