1. 返回iterable对象
def h():
for i in range(0, 10):
yield i
for i in h():
print i
yield会返回一个iterable对象,因此直接调用h()不会执行。
1. 返回iterable对象
def h():
for i in range(0, 10):
yield i
for i in h():
print i
yield会返回一个iterable对象,因此直接调用h()不会执行。