When a variable is created by except ... as variable, one cannot access the variable from outside of except block. Why is it happening? The only way to access the value of variable I've found is to assign it to another variable:
c = 10
try:
d = c[0]
except Exception as err:
b = err
print(b)
print(err)
print(b) shows error message: "'int' object is not subscriptable".
But print(err) raises "NameError: name 'err' is not defined".
So, the question is: why is the variable "err" gone?