Created
March 11, 2020 05:37
-
-
Save mayankdawar/ba75a68e648c3e2cf22a083859c154bf to your computer and use it in GitHub Desktop.
Write a Program to read last n files from a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wap to read last n files from a file | |
f = open("output.txt", "r") | |
n = int(input("Enter No. of lines:")) | |
lst = [] | |
for x in f: | |
l1 = f.readlines() | |
lst = lst +l1 | |
print(lst[n:]) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment