python——gevent

import gevent
from gevent import monkey
import time
monkey.patch_all()
def func1():
print("111111")
time.sleep(1)

def func2():
print("2222")
time.sleep(1)

def func3():
print("3333")
time.sleep(1)

g1=gevent.spawn(func1)
g2=gevent.spawn(func2)
g3=gevent.spawn(func3)
g1.join()
g3.join()
g2.join()
print("我结束了")

posted @ 2021-03-03 21:27  朵朵奇fa  阅读(53)  评论(0编辑  收藏  举报