演示生成器 2015/05/31 12915 #演示生成器 #!/usr/local/bin/python2.5 def genner(n): for i in range(n): yield i ** 2 x = genner(5) print x.next() print x.next() print x.next() print x.next() print x.next()