def fun1():
for i in range(1,5):
return i
def fun2():
for i in range(1,5):
print i
def fun3():
for i in range(1,5):
yield i
print fun1() >>>return只返回一次,仅一次,就跳出
print "--------------\n"
print fun2() >>>print 循环n次
print "--------------\n"
print "yield function"
---------------------------
x = []
x = fun3() >>>将yield当成一个与数组有关的
for i in x:
print i,"xxx:::”
——————————————