摘要:
import asyncio from threading import Thread import time print('main start:',time.time()) async def download(i): print(i, time.time()) await asyncio.sleep(i) b=linkextractor(i) if b ... 阅读全文
摘要:
https://www.jianshu.com/p/0efdc952e8ca 阅读全文
摘要:
import asyncio from threading import Thread import time now = lambda: time.time() print('start',now()) def start_loop(loop): asyncio.set_event_loop(loop) loop.run_forever() async def do_so... 阅读全文
摘要:
单个的task 阅读全文
摘要:
close的方法主要是关闭子生成器,需要注意的有4点: 1.如果生成器close后,还继续next,会报错StopIteration [图片] 2.如果我捕获了异常,将GeneratorExit处理了,之后还有一个yield,这时候close之后,还要next会报错RuntimeError异常 3. 阅读全文