Answers for "python script to dowload a file and write only last 20 lines"

1

Write a Python program to read last n lines of a file

def read_lastnlines(fname,n):
	with open('file1.txt') as f:
		for line in (f.readlines() [-n:]):
			print(line)

read_lastnlines('file1.txt',3)
Posted by: Guest on November-27-2020

Code answers related to "python script to dowload a file and write only last 20 lines"

Python Answers by Framework

Browse Popular Code Answers by Language