end=''是關閉自動換行的意思吧?下面代碼的輸出不還是換行了麼?
data.seek(0) #使用seek()方法回到文件起始位置
for each_line in data:
print(each_line,end='')
Man: Is this the right room for an argument?
Other Man: I've told you once.
Man: No you haven't!
Other Man: Yes I have.
Man: When?
Other Man: Just now.
Man: No you didn't!
end = '' 是關閉了print函數的換行,print函數輸出時默認在字符串末尾加換行
你輸出的內容中的換行,應該是文本內容本身含有的換行
如果不用end = '' 輸出結果應該如下:
Man: Is this the right room for an argument?
Other Man: I've told you once.
Man: No you haven't!
Other Man: Yes I have.
Man: When?
Other Man: Just now.
Man: No you didn't!