Python 3: Try Except Else Finally - Learn about error handling in Python

Veröffentlicht am: 08 Mai 2022
auf dem Kanal: Cloud Security Training & Consulting
100
1

Python 3: Try Except Else Finally - Learn about error handling in Python

Try except
python cert - important concept
try:
number1 = int(input("Enter first number: "))
number2 = int(input("Enter second number: "))
division = number2 / number1
print(f'Result for division is {division}')

except ZeroDivisionError:
print("Cannot devide by zero!")
except:
print("Something went wrong")

else:
this block will only run when the try block is successful
print("Division was successful")

finally:
this block will always run
print("This code will always run")
print("Repeat with better values")


Auf dieser Seite können Sie das Online-Video Python 3: Try Except Else Finally - Learn about error handling in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Cloud Security Training & Consulting 08 Mai 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 100 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!