协程

def a():

while True:

print('哈哈')

yield None

def b():

while True:

print('嘿嘿')

yield None

x1 = a()

x2 = b()

while True:

next(x1)

next(g2)

你可能感兴趣的:(协程)