# 函数形式
def fun():
for i in range(10):
yield i
res = fun()
print(res.__next__())
print(res.__next__())
print(res.__next__())
print(res.__next__())
print(next(res))
print(next(res))
# (三元表达式)
res = (i for i in range(10))
print(res.__next__())
print(res.__next__())
print(res.__next__())
print(res.__next__())
print(next(res))
print(next(res))