Python Tutorial | Exception Handling | Part 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 พ.ค. 2023
  • Have you ever wondered what to do when your code runs without any exceptions? What about when your code does generate an exception, but you still need to execute some code afterward? In this video, we'll explore the power of the "else" and "finally" keywords in Python's try-except statement. We'll demonstrate how the "else" block can be used to specify code that should be executed if no exceptions were raised in the try block. We'll also show how the "finally" block can be used to define code that should always execute, whether or not an exception was raised. These concepts are important for writing robust code that can handle any scenario that comes your way. Join us as we dive into the world of Python exception handling and explore the possibilities of using the "else" and "finally" clauses to create better code.

ความคิดเห็น •