‘’’
yield和send
‘’’
def a():
value=yield 1
yield value
b=a()
#print(next(b))
#send 发送给下一个yield的值
print(b.send(None))
print(b.send(‘qqq’))
2021-03-11
最新推荐文章于 2021-11-21 12:10:25 发布
‘’’
yield和send
‘’’
def a():
value=yield 1
yield value
b=a()
#print(next(b))
#send 发送给下一个yield的值
print(b.send(None))
print(b.send(‘qqq’))