1
7sDream 2016-08-20 21:17:33 +08:00
print([f() for f in count()])
另外发帖之前最好看一下右边发帖提示里的 markdown 语法,代码发出来要有语法高亮和缩进这样比较方便看。 |
2
prefere 2016-08-20 21:20:25 +08:00 1
python2.7
def count(): fs = [] for i in range(1, 4): def f(): return i*i fs.append(f) return fs a = [] for i in count(): a.append(i()) print a |