python ile satırları ters çevirmek için yapmamız gerekenler.
Örnek dosyamız şu şekilde olsun:
ters.txt
9
8
7
6
5
4
3
2
1
with open("ters.txt", "r") as f:
lines = f.readlines()
f.close()
with open("duz.txt", "w+") as f:
for l in reversed(lines):
f.write(l)
f.close()
Sonuç aşağıdaki gibi olacaktır.
duz.txt
1
2
3
4
5
6
7
8
9