I'm doing some simple python exercises in which the target is to simply read a text file and then print it. But my program prints one extra blank line.
Text file is model.txt, which has 3 text rows and 1 blank row, is displayed here
First row
Second row
This is the third row
My program is
file1=open("model.txt","r")
while True:
row=file1.readline()
print(row[:-1])
if row=="":
break
file1.close()
Now the wanted print result is:
First row
Second row
This is the third row
But instead there is one extra blank line after the print:
First row
Second row
This is the third row
There is a way to remove that one blank line but I haven't been able to figure it out.