python-12 返回值、作用域、嵌套、global
函数返回值






函数作用域 #F44336





嵌套函数






def outer3():
print('~~~~~~~~~~')
o = 65
def inner():
o = 97
print("inner", chr(o), o)
inner()
print("outer", chr(o), o)



x = x +1 #F44336 赋值即定义 , “ x = ” 表明在经行赋值,则右边的 “ x ”使用局部变量,但是局部作用域内没有定义 “ x ” 。




global语句







浙公网安备 33010602011771号