file = open('a.txt','r') i = -1 while True: i = i - 1 file.seek(i,2) if file.read(1) == '\n': break print file.readline().strip()复制代码
print open('a.txt').readlines()[-1]复制代码