标签:global 了解 oba def glob oca 全局 nonlocal pre
a = 0
for i in range(1,101):
a += i
print(a)
##
# total = 0
# def add1():
# global total ###(全局变量 global)
# total += 1
# add1()
# add1()
# add1()
#
# print(total)
### (了解) nonlocal
def outer():
num = 10
def inner():
num =100
print(num)
inner()
print(num)
outer()
标签:global 了解 oba def glob oca 全局 nonlocal pre
原文地址:https://www.cnblogs.com/psy0508/p/9973542.html