title: How to access global variable in Python?
body: <p>I have a case :</p>
  
  <pre><code>x = "me"
  
  class Test():    
      global x
  
      def hello(self):
          if x == "me":
              x = "Hei..!"
              return "success"
  </code></pre>
  
  <p>I try this case with shell. </p>
  
  <p>How I can <code>print x</code> which the output/value of <code>x</code> is <code>Hei..!</code>?</p>
  
  <p>I tried with</p>
  
  <pre><code>Test().hello # for running def hello
  print x # for print the value of x
  </code></pre>
  
  <p>After I print <code>x</code>, the output is still <code>me</code>.</p>