Exception Handling in Python || Try || Else || Finally || Part - 2

Veröffentlicht am: 20 Oktober 2021
auf dem Kanal: Ddhruv Arora
24
10

In this video, I have discussed Exception Handling in python

Try and Except statements are used to catch errors and to protect our program from unexpectedly terminating.

We can have optional statements Else and Finally.

Else will be executed only if our Try block was successful.

Finally will be executed in all situations and conditions.

A try statement can have multiple except clauses.
-----------------------------------------------------------------------------------------------------------------------
Syntax 1:
try:
code goes here
except:
exception code goes here

Syntax 2:
try:
code goes here
except {Exception_type} as e:
exception code goes here

Syntax 3:
try:
code goes here
except {Exception_type 1} :
exception code goes here
except {Exception_type 2} :
exception code goes here
except {Exception_type 3} :
exception code goes here

Syntax 4:
try:
code goes here
except (Exception_type_1, Exception _type_2, ....}:
exception code goes here

Syntax 5:
try:
your code
except:
your code
else:
code goes here

Syntax 6:
try:
your code
except:
your code
else:
code goes here
finally:
code goes here

Syntax 7:
try:
your code
except:
your code
finally:
code goes here

Syntax 8:
try:
your code
finally:
code goes here

-----------------------------------------------------------------------------------------------------------------------
Tip: Try to add this to a file-handling code, and also to functions.
-----------------------------------------------------------------------------------------------------------------------
Thank you for watching and reading.
-----------------------------------------------------------------------------------------------------------------------
Learning happily is the way to success.
Revise Rewrite Retry is the stairway to success.
Never stop learning because life never stops teaching.
-----------------------------------------------------------------------------------------------------------------------
Happy Coding ahead 👨‍🎓🌟✨
-----------------------------------------------------------------------------------------------------------------------
#python #pythonprogramming #coding #learning #teaching #youtuber #pythonfrombasics.


Auf dieser Seite können Sie das Online-Video Exception Handling in Python || Try || Else || Finally || Part - 2 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Ddhruv Arora 20 Oktober 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 24 Mal angesehen und es wurde von 10 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!