Read the Bottom N Lines of a File in Python

Using Operating System Commands in Python

Use the Linux/Mac tail command to provide the data:

line = subprocess.check_output(['tail', '-1', somefile.txt])

Creating a Python Only Script

Read the whole file into memory and only print out the last line/s:

with open('somefile.txt', 'r') as f:
    lines =
    last_line = lines[-1]