Access to class attributes by using a variable in Python?
<p>In PHP i can access class attributes like this:</p>

<pre><code>&lt;?php // very simple :)
class TestClass {}
$tc = new TestClass{};
$attribute = 'foo';
$tc-&gt;{$attribute} = 'bar';
echo $tc-&gt;foo
// should echo 'bar'
</code></pre>

<p>How can i do this in Python?</p>

<pre><code>class TestClass()
tc = TestClass
attribute = 'foo'
# here comes the magic?
print tc.foo
# should echo 'bar'
</code></pre>
