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.
You can read and edit all the line doing something like:
file = open('your_file.txt', 'r')
read_file = file.readlines()
file.close()
file1 = open('your_file.txt', 'w')
var = 'filename.txt'
for lec in range(len(read_file)):
if lec == 1:
file1.write(' ' % var)
else:
file1.write(read_file[lec])
file1.close()