不返回列表函数,直接运行完返回列表值,不进行g()直接在里面运行完f(),为什么不行
#!/usr/bin/python
#coding=utf-8
def count(x):
fs = []
for i in range(1, x):
def f():
return i*i
fs.append(f(i))
return fs
for n in count(4):
print n
#!/usr/bin/python
#coding=utf-8
def count(x):
fs = []
for i in range(1, x):
def f():
return i*i
fs.append(f(i))
return fs
for n in count(4):
print n
2018-07-31
举报