greenlet
作者:互联网
#_author:来童星
#date:2019/12/12
from greenlet import greenlet
def test1():
print(12)
gr2.switch()
print(34)
gr2.switch()
def test2():
print(56)
gr1.switch()
print(78)
gr1 = greenlet(test1)# <greenlet.greenlet object at 0x00000293A37F4048>
gr2 = greenlet(test2)
gr1.switch()
运行结果:
12
56
34
78
56
78
标签:test1,gr2,gr1,switch,greenlet,print 来源: https://www.cnblogs.com/startl/p/12031579.html