例外の情報を出力するときに、自分で整形した内容ではなく、エラーの情報そのものを出力する方法です。 exceptで受ける形名を Exception にしておけばすべての例外を受け取れます。
try :
...
x = 1/0 //よくある例外(integer division or modulo by zero)
...
except Exception as e:
print '***** エラー内容 *****'
print 'type:' + str(type(e))
print 'args:' + str(e.args)
print 'message:' + e.message
print 'e自身:' + str(e)
出力はこんな感じ
***** エラー内容 *****
type:<type 'exceptions.ZeroDivisionError'>
args:('integer division or modulo by zero',)
message:integer division or modulo by zero
e自身:integer division or modulo by zero


