send

def bar():
print('ok')
count=yield 1
print(count)
print('ok2')
yield 2
# for i in bar():
# print(i)
b = bar()
ret=b.send(None) #第一次send前如果没有next(),只能传一个send(None),因为不知道给谁传值。
b.send('bbbbb')
print(ret)
posted @ 2019-07-09 10:03  python小白丶  阅读(463)  评论(0)    收藏  举报