How to dynamically select a method call in Python?
<p>I have a code similar to this:</p>

<pre><code>if command == "print":
     foo_obj.print()

if command == "install":
     foo_obj.install()

if command == "remove":
     foo_obj.remove()
</code></pre>

<p><code>command</code> is a string (I define it by parsing command line arguments, but that's beyond the point). Is there a way to replace the above chunck of code with something similar to this?</p>

<pre><code>foo_obj.function(command)
</code></pre>

<p>For the recored I'm using Python 2.7</p>
