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!