-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles_reading.py
More file actions
66 lines (43 loc) · 1.16 KB
/
Copy pathfiles_reading.py
File metadata and controls
66 lines (43 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# try:
# file = open("newfile.txt","r")
# print(file)
# except FileNotFoundError:
# print("Dosya Okuma Hatası")
# finally:
# print("Dosya Kapandı")
# file.close
file = open("newfile.txt","r",encoding ="utf-8")
#### for döngüsü
# for i in file:
# print(i, end="")
# file.close()
#### read() Fonksiyonu
# content1 = file.read()
# print("içerik1")
# print(content1)
# content2 = file.read()
# print("içerik2")
# print(content2) ####Kursör en sonda kaldığı için texteki veri yeniden oku dersen birşey okumaz.ançak dosya açmayı tekrar yaparsan okur..
# file.close()
#########
# content = file.read(5)
# content = file.read(3)
# content = file.read(60)
# print(content)
# file.close()
#********** readline() fonksiyonu
# print(file.readline(),end="")
# print(file.readline(),end="")
# print(file.readline(),end="")
# print(file.readline(),end="")
# print(file.readline(),end="")
# print(file.readline())
# print(file.readline())
# print(file.readline())
# file.close()
#********** readline() fonksiyonu
liste = file.readlines() # içerik liste haline gelir...
print(liste[0])
print(liste[1])
print(liste[2])
file.close()