进程池线程池
协程
from gevent import monkey;monkey.patch_all() import gevent,time def eat(name): print('%s eat 1'%name) time.sleep(2) print('%s eat 2'%name) def play(name): print('%s play 1'%name) time.sleep(1) print('%s play 2'%name) g1=gevent.spawn(eat,'egon') g2=gevent.spawn(play,name='egon') g1.join() g2.join() print('主') 结果是: egon eat 1 egon play 1 egon play 2 egon eat 2 主
io模型