Python Program to Catch Multiple Exceptions in One Line
# Python Program to Catch Multiple Exceptions in One Line
# variable declaration
a = 1
str = "hello"
# function definition
def func(a):
result: a + str # unboundlocalerror
print(result)
# try block to get the exception
try:
func(a)
except(TypeError, UnboundLocalError) as e:
print(e)
Output:
local variable 'result' referenced before assignment
About The Author
Shailendra Bramhvanshi, Founder at Techaroha Solutions Private Limited and CEO at Newtum Solutions Private Limited. BlockChain Experts with 12 years of IT Experience in of all aspects of running Organization and Project Management. I have created different coins to help the business to bring more trust. Recently deployed a stable coin in India TrueINR and working on few cryptocurrency exchanges. My Team is being rated as a top 10 blockchain service provider in India by Silicon India