课后作业
def funX():x = 5
def funY():
nonlocal x
x += 1
return x
return funY
a = funX()
print(a())
print(a())
print(a())
请教各位大佬,这一题的课后解释还是没怎么看明白 https://fishc.com.cn/forum.php?mod=viewthread&tid=168562&highlight=nonlocal 逃兵 发表于 2021-3-25 18:49
https://fishc.com.cn/forum.php?mod=viewthread&tid=168562&highlight=nonlocal
感谢大佬的分享
页:
[1]