Python/Exception

From Fundamental Ramen
< Python
Revision as of 08:43, 31 May 2018 by Tacoball (talk | contribs) (Created page with "<source lang="python"> try: n = 1 / 0 except Exception as e: print('It sucks!') print('Class: {}'.format(type(e).__name__)) print('Message: {}'.format(e))...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
try:
    n = 1 / 0
except Exception as e:
    print('It sucks!')
    print('Class: {}'.format(type(e).__name__))
    print('Message: {}'.format(e))
    print('Args:')
    for arg in e.args:
        print('    {}'.format(arg))