Answers for "try and except errors"

3

try except

try:
    print("I will try to print this line of code")
except:
    print("I will print this line of code if an error is encountered")
else:
    print("I will print this line of code if there's no error encountered")
finally:
    print("I will print this line of code even if there's an error or no error encountered")
Posted by: Guest on September-03-2021
6

try catch exception

First try block try to handle it
if not then catch block will handle it.
Finally block will executed regardless
of the outcome
Posted by: Guest on January-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language