Python:Get the name of a variable
<p>I declare a variable, say:</p>

<pre><code>var=33
</code></pre>

<p>I want to assign to another variable the string 'var', that is , how to get the symbol's name of the value of the variable.</p>

<p>How can I do it ?</p>

<hr>

<p>I reformulate the question.</p>

<pre><code>WHITE=0
RED=1
BLACK=2
</code></pre>

<p>X=2.</p>

<p>I want to assign the value 'BLACK' to a variable, say, Y, taking into account that X=2.</p>

<p>It is hard to formulate exactly this question.</p>

<p>I want to avoid a code like this:</p>

<pre><code>color=''
if X==0:
     color='WHITE'
elif X==1:
etc.
</code></pre>

<p>Is it possible to get the name of the color-variable as a string?</p>
