yield需要返回多个结果时使用
#coding:utf-8
def get():
yield 1
yield 2
return
yield 3
if __name__=='__main__':
for i in get():
print i
输出结果
1
2
yield需要返回多个结果时使用
#coding:utf-8
def get():
yield 1
yield 2
return
yield 3
if __name__=='__main__':
for i in get():
print i
输出结果
1
2