anyone know how do i read the "data" line by line?. My goal is to read the data line by line and send it to somewhere when pressing "send". Currently i'm able to read the data but it doesn't read as line by line.
What i've done
def mouseHover(event):
x = lbox.curselection()[0]
file = lbox.get(x)
self.s.send(("fdown~" + file).encode("utf-8"))
self.s.recv(1024).decode("utf-8")
self.s.send("OK".encode("utf-8"))
open(file , 'wb+') #must have
global data
data = (self.s.recv(1024).decode("utf-8") )
sys.stdout.flush()
self.text.insert(tk.END, data)
lbox.bind("<<ListboxSelect>>", mouseHover)
One could do something like this:
lines = [entry.strip() for entry in open("filename.txt", "r")]
for line in lines:
[Do whatever]