Can we call function defined in try from except or finally in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we call function defined in try from except or finally in python

Can we call function defined in try from except or finally in python

3rd Feb 2019, 4:26 AM
prashant nagargoje
1 Answer
+ 6
yes! yes! Source: try: def hu(): print('yes!') 5/0 except: hu() finally: hu() (of course this will only work if the function is defined before the exception is raised)
3rd Feb 2019, 7:21 AM
Anna
Anna - avatar