python-CSD-kursu/python-temel/try.except.2.py
2023-08-17 19:15:59 +03:00

22 lines
397 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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