問題:
What am I doing wrong here?我在這裏做錯了什麼?
counter = 0
def increment():
counter += 1
increment()
The above code throws an UnboundLocalError
.上面的代碼拋出一個UnboundLocalError
。
解決方案:
參考一: https://en.stackoom.com/question/csBf參考二: https://stackoom.com/question/csBf