Original Sources:

Used in this file:

~ Ex.:
def remove_last_line_from_file(file):
	file.seek(0, os.SEEK_END)
	pos = file.tell() - 1
	file.seek(pos, os.SEEK_SET)
	file.truncate()
	file.seek(0, 0)
	print(file.read())
 
 
with open(abs_path_to_file, "r+") as file:
	remove_last_line_from_file(file)