title: change variable value using for loop
body: <p>I have a problem that seems like it should be so simple but I can't work it out. I have this section of code: </p>
  
  <pre><code>Avalue = '2:7'
  Bvalue = '4?3'
  Cvalue = '5\t8'
      for x in [Avalue,Bvalue,Cvalue]:
          for illChar in ['?','/','|','*','&lt;','&gt;',':','\n','\t','"']:
              if illChar in x:
                 x = x.replace(illChar, "")
          int(x)
          print type(x)
  
      print type(Avalue)
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <pre><code> &lt;type 'int'&gt;
   &lt;type 'int'&gt;
   &lt;type 'int'&gt;
   &lt;type 'unicode'&gt;
  </code></pre>
  
  <p>What I want to do is to strip out any of the illegal characters, and then change Avalue,Bvalue,Cvalue to integers rather than strings, so that Avalue becomes 27 for example.</p>
  
  <p>But the above code doesn't actually change the original variable, it just changes the value of the variable x within that list which takes it's value from the original value of Avalue (or Bvalue or Cvalue etc). Now, I know I could just change each original variable individually, i.e. <code>Avalue = int(Avalue)</code>, but if I end up having a whole load of variables to change it would seem more elegant to use a loop.</p>
  
  <p>So, is there a way to alter variables by using a for loop like this?</p>
  
  <p>edit: ok sorry I may have caused confusion with the example above, perhaps this might make more sense. Suppose I have the following:</p>
  
  <pre><code>Avalue = 'hello'
  Bvalue = 'my name'
  Cvalue = 'is'
      for x in [Avalue,Bvalue,Cvalue]:
            x = 'slimshady'
  print Avalue
  </code></pre>
  
  <p>The above doesn't work, Avalue remains as 'hello'. Suppose I wanted Avalue Bvalue Cvalue all to be permanently changed to 'slimshady' can I do that using a loop?</p>