def fib():
a,b = 0,1
for i in range(10):
var = yield b
print(var)
a,b = b,a+b
b = fib()
print(b.send(None))#send第一次参数只能是none
print(b.send('哈哈哈'))#可以传参数
def fib():
a,b = 0,1
for i in range(10):
var = yield b
print(var)
a,b = b,a+b
b = fib()
print(b.send(None))#send第一次参数只能是none
print(b.send('哈哈哈'))#可以传参数
本文标题:send
本文链接:https://www.haomeiwen.com/subject/tyeihctx.html
网友评论