📜  类内的变量未检测到 python 代码示例中的全局变量

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

代码示例1
some_global_variable

class TestClass():
    def run(self):
        #we can access it by defining the variable as global inside the function
        global some_global_variable 
        for i in range(10):
            some_global_variable = 1
            print(some_global_variable)