阅读背景:

python基于yield实现协程

来源:互联网 
def f1():
    print(11)
    yield
    print(22)
    yield
    print(33)

def f2():
    print(55)
    yield
    print(66)
    yield
    print(77)

v1 = f1()
v2 = f2()

next(v1) # v1.send(None)
next(v2) # v1.send(None)
next(v1) # v1.send(None)
next(v2) # v1.send(None)
next(v1) # v1.send(None)
next(v2) # v1.send(None)def f1():
    print(11)
    yield
    print(22)



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: