问题:
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