I have a two requirements .
First Requirement-I want to read the last line of a file and assign the last value to a variable in python.
Why you just read all the lines and store the last line to the variable?
with open('filename.txt', 'r') as f: last_line = f_read.readlines()[-1]