exception example 2
This commit is contained in:
parent
e5c86877c9
commit
d321366dab
17
python-temel/exception.example.2.py
Normal file
17
python-temel/exception.example.2.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
def foo():
|
||||
print('foo begins...')
|
||||
bar()
|
||||
print('foo ends...')
|
||||
|
||||
def bar():
|
||||
print('bar begins...')
|
||||
int('xxx') # ValueError
|
||||
print('bar ends...')
|
||||
|
||||
try:
|
||||
foo()
|
||||
except (ValueError, TypeError):
|
||||
print("ValueError ya da TypeError exception'ı oluştu")
|
||||
except IndexError:
|
||||
print("IndexErrorexception'ı oluştu")
|
||||
print('ends...')
|
Loading…
Reference in New Issue
Block a user