# -*- coding: utf-8 -*-
from collections import deque
def tail(n): # n:指定输出文件中最后几行
with open('test.txt', 'r') as f:
q = deque(f, n)
return q
for line in tail(5):
print(line, end='')
标签:deque,输出,几行,tail,Linux,line
From: https://www.cnblogs.com/zylyehuo/p/17637355.html