为什么是1,4,9
def count():
fs = []
for i in range(1, 4):
def f(j):
def g():
return j*j
return g
r = f(i)
fs.append(r)
return fs
f1, f2, f3 = count()
print f1(),f2(),f3()
为什么结果是1,4,9,执行print的时候不也应该i=3了吗?
def count():
fs = []
for i in range(1, 4):
def f(j):
def g():
return j*j
return g
r = f(i)
fs.append(r)
return fs
f1, f2, f3 = count()
print f1(),f2(),f3()
为什么结果是1,4,9,执行print的时候不也应该i=3了吗?
2019-07-29
举报