exception example 2

This commit is contained in:
Mert Gör ☭ 2023-08-19 18:10:05 +03:00
parent e5c86877c9
commit d321366dab
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
1 changed files with 17 additions and 0 deletions

View 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...')