python 生成器

# 生成器
n = (i for i in range(0,10000))
print(n)


def gen(max):
n = 0
while n <= max:
n +=1
yield n

g = gen(10000)
for i in g:
print(i)
print(''' ▶ 学编程,你不是一个人在战斗 | __--__|_ II=======00000[/ ★101___| _____\_______|/-----. /___mingrisoft.com____| ◎◎◎◎◎◎◎ © / ~~~~~~~~~~~~~~~ ''')
原文地址:https://www.cnblogs.com/1109v/p/9402082.html