📅  最后修改于: 2022-03-11 14:46:02.874000             🧑  作者: Mango
def read_lastnlines(fname,n):
with open('file1.txt') as f:
for line in (f.readlines() [-n:]):
print(line)
read_lastnlines('file1.txt',3)