#协程是遇到阻塞,就切换到别的协程 import gevent def task(pid): """ Some non-deterministic task """ gevent.sleep(0.5) print('Task %s done' % pid) def synchronous(): #同步 for i in range(1,10): task(i) def asynchronous(): #异步 threads = [gevent.spawn(task, i) for i in range...