Exception handling

244 views
168 views

Published on

Exception handling

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
244
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Exception handling

  1. 1. Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
  2. 2. EXCEPTION HANDLING SHEETHAL U sheethu@gmail.com www.facebook.com/sheethu in.linkedin.com/in/sheethal Ummanath 9447531524
  3. 3. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance.www.baabtra.com | www.massbaab.com |www.baabte.com
  4. 4. EXCEPTION Exceptions are events that can modify the flow or control through a program. They are automatically triggered on errors. try/except : catch and recover from raised by you or Python exceptions try/finally: perform cleanup actions whether exceptions occur or not raise: trigger an exception manually in your code
  5. 5. • An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the programs instructions.• In general, when a Python script encounters a situation that it cant cope with, it raises an exception.
  6. 6. • If you have some suspicious code that may raise an exception, you can defend your program by placing the suspicious code in a try: block.• After the try: block, include an except: statement, followed by a block of code which handles the problem as elegantly as possible.
  7. 7. syntax• try: You do your operations here; ......................except ExceptionI: If there is ExceptionI, then execute this block.except ExceptionII: If there is ExceptionII, then execute this block. ......................else: If there is no exception then execute this block.
  8. 8. Contact Us

×