Skip to content

Instantly share code, notes, and snippets.

@mayankdawar
Created March 11, 2020 05:37
Show Gist options
  • Save mayankdawar/ba75a68e648c3e2cf22a083859c154bf to your computer and use it in GitHub Desktop.
Save mayankdawar/ba75a68e648c3e2cf22a083859c154bf to your computer and use it in GitHub Desktop.
Write a Program to read last n files from a file
# 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