Answers for "when would you use try/except block"

2

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

Code answers related to "when would you use try/except block"

Python Answers by Framework

Browse Popular Code Answers by Language