from collections import deque
with open(file_name) as f:
print(list(deque(f, 30)))
with open(file_name) as f:
for row in deque(f, 30):
print (row.strip())
{
"cmd": "c:/Python34/python.exe -u \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "UTF-8"}
}