Catch anything and save it into a variable
<p>I'm wondering if there is a keyword for "all" in python <code>except</code>.  I've ran into this seemingly simple problem:</p>

<pre><code>try:
    #do stuff
except any as error:
    print('error: {err}'.format(err=error))
</code></pre>

<p>I know that you can do <code>except:</code> to catch all errors, but I don't know how to add an <code>as</code> keyword to get a <code>print</code>able object.  I want to catch any error and be able to get an object for use in printing or something else.</p>

<p>Yes, just catch <code>Exception</code>:</p>

<p><code>except Exception as ex:</code></p>

python except