摘要: 1. greenlet 自行执行的微线程 https://greenlet.readthedocs.io/en/latest/greenlet.html 2. 终端安装 pip install greenlet 3. 举个栗子 import time from greenlet import gre 阅读全文
posted @ 2023-03-23 17:29 筱筱的春天 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1.协程定义 不开辟新的线程的基础上,实现多个任务,是个特殊的生成器。一秒钟能切换上百次。 2.原始版协程 import time #1.work1 生成器 def work1(): while True: print("executing work1......") yield time.slee 阅读全文
posted @ 2023-03-23 14:46 筱筱的春天 阅读(29) 评论(0) 推荐(0) 编辑