作用——保存區域資訊不被銷毀,
def num2(n):
i = 1
def num_in():
nonlocal i
i = i + n
print(i)
return num_in
i = 0
start = num2(3)
while i<5:
start()
i += 1
本文首發于python黑洞網,博客園同步更新
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/169919.html
標籤:Python
上一篇:python(MD5 單向加密)
下一篇:Python“三大器”之生成器
