📜  python 全局变量 unboundlocalerror - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:58.742000             🧑  作者: Mango

代码示例1
#You must annouce a variable as global
function_uses = 0

def function():
  #To do that type this:
  global function_uses
  #global 
  print('This is a function')
  function_uses += 1