0
Q:

except as Exception:

>>> def catch():
...     try:
...         asd()
...     except Exception as e:
...         print e.message, e.args
... 
>>> catch()
global name 'asd' is not defined ("global name 'asd' is not defined",)
8

  try:
  print(x)
except NameError:
  print("Variable x 
  is not defined")
except:
  print("Something else went 
  wrong") 
2

New to Communities?

Join the community