Finding what methods an object has
<p>Given a Python object of any kind, is there an easy way to get a list of all methods that this object has?<br>
Or,</p>

<p>if this is not possible, is there at least an easy way to check if it has a particular method other than simply checking if an error occurs when the method is called?</p>

<p>It appears you can use this code, replacing 'object' with the object you're interested in:-</p>

<pre><code>[method for method in dir(object) if callable(getattr(object, method))]
</code></pre>

<p>I discovered it at <a href="http://www.diveintopython.net/power_of_introspection/index.html">this site</a>, hopefully that should provide some further detail!</p>
