I am trying to read the last 3 lines from the file, but only the last one is given. I do not understand what the catch is. Thank you in advance!
with open("c.txt", 'r') as f: last3 = deque(f, 3) for line in last3: co.append(line.strip().split(',')) for pair in co: x,y,z = pair[0],pair[2] sommething = x,y return render_template("page.html", something=something) f.close()
sommethingvariable and only the last value remains in it. - user194374