python_exception_learning
# author: Roy.G
data={"roy":1,"boy":2}
data1=[1,2,3]
try:
data["roy"]
data[5]
# except (KeyError,IndexError) as e:
except Exception as e: # detect all exception
print("exception;",e)
# author: Roy.G
data={"roy":1,"boy":2}
data1=[1,2,3]
try:
data["roy"]
data[5]
# except (KeyError,IndexError) as e:
except Exception as e: # detect all exception
print("exception;",e)