In [1]:
#program to print line by line from end to start in reverse
def reverseprint():
f=open('fil1.txt','r')
l=f.readlines()
print('number of line in File is ',len(l))
for i in range(-1,-len(l)-1,-1):
print(l[i])
In [2]:
#program to print line by line from end to start in reverse
def reverseprint1():
f=open('fil1.txt','r')
l=f.readlines()
print('number of line in File is ',len(l))
for i in range(len(l)-1,-1,-1):
print(l[i])
In [4]:
reverseprint() # calling function
In [5]:
reverseprint1() #calling function for 1
In [ ]:
No comments:
Post a Comment