-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9-Exception.py
53 lines (48 loc) · 1.18 KB
/
9-Exception.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Exception
# Exceptions are the (errors) which we can handle
# All the exception classes are must need to derive from exception
# Ex:
# ZeroDivisionError or DivideByZero Exception,
# StackOverflow Exception and more ,
# How to handle Exception
#
# syntax:
# try: This is try catch block , suppose any errors coming in the code ,that time we use this
# ..........
# Except IOError:
# .............
#
# We have finally block
# We have else block
# Syntax
# try:
# ..........
# Except:
# .........
# else:
# ........
# finally
# .........
# print(1/0)
# try:
# print(1/0)
# except ZeroDivisionError as i:
# print("Handling " + str(i))
# else:
# print("Null Error")
# # except BaseException:
# # print("Here Exception")
# finally:
# print("Please try again")
# Customs Exceotions
# class ApplicationCustomException(BaseException):
# pass
#
# class validationException(ApplicationCustomException):
# pass
# try:
# if 0 < 10 :
# raise validationException
# except validationException as ex:
# print(validationException)
# print("Excepation raise")