def fu():
a=10
def zi(x):
nonlocal a
a=20
return 2*x+1
print(zi(5),a)
fu()
#直接调用会报错
#zi(5)
a772304419 ©著作权
def fu():
a=10
def zi(x):
nonlocal a
a=20
return 2*x+1
print(zi(5),a)
fu()
#直接调用会报错
#zi(5)
闭包函数
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M