x=10def t(): global x #global关键字先声明 x = 15 y = 6 def tt(): nonlocal y #nonlocal关键字先声明 y = y + 1 print(x) tt()t()