Skip to content

Commit c6bffa7

Browse files
author
mustafa
committed
try except raise
1 parent ebb4bef commit c6bffa7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tryexcept_file.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
try:
3+
with open("deneme.xtxr") as file:
4+
data = file.read()
5+
deneme = 0/0
6+
except FileNotFoundError:
7+
with open('deneme.xtxr',"w") as file:
8+
print("Dosya oluşturuldu")
9+
file.write("x")
10+
except ZeroDivisionError:
11+
deneme = 0
12+
13+
14+
15+
16+
class BenimExce(Exception):
17+
pass
18+
19+
20+
21+
deneme = "ismail"
22+
23+
if deneme != "mustafa":
24+
raise BenimExce("Dememe mustafa olmalı")

0 commit comments

Comments
 (0)