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