Solving error: local variable 'counter' referenced before assignment

前端 未结 0 1967
無奈伤痛
無奈伤痛 2020-11-22 17:27

Small question about globals. I have the following code:

counter = 0
class A():
    global counter

    def connect():
        counter += 1
        print(&quo         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题