title: How can I access global variable inside class in Python
body: <p>I have this:</p>
  
  <pre><code>g_c = 0
  
  class TestClass():
      global g_c
      def run(self):
          for i in range(10):
              g_c = 1
              print(g_c)
  
  t = TestClass()
  t.run()
  
  print(g_c)
  </code></pre>
  
  <p>how can I actually modify my global variable g_c?</p>