线程是操作系统层面的“并行”, 协程是应用程序层面的“并行”. 协程本质上就是:提供一个环境,保存一些需要等待的任务,当这些任务可以执行(等待结束)的时候,能够执行.再等待的过程中,程序可以执行别的任务. asyncio是python3.4版本引入到标准库因此要注意python版本 我的python环境 Python (v3. , ::) [MSC v. bit (Inte l)] on win32 Type "help", "copyright", "c
from :http://masnun.com/2015/11/20/python-asyncio-future-task-and-the-event-loop.html Event Loop On any platform, when we want to do something asynchronously, it usually involves an event loop. An event loop is a loop that can register tasks to be ex