请问下 为什么我没换行,下引号总是会自动换行,代码如下 with open("1.txt","r") as a: with open("2.txt", "a") as f: while True: line = a.readline() if line: name = "or"+" "+"nickname =" + """ + line + """ print(name) break f.write(name) else: break f.close() a.close()
输出的结果如下 下引号总是会自动换行, or nickname ="��ѩ�� "
1
qyzxgl 2018-03-29 22:44:54 +08:00 via iPhone
print 默认换行的 想不换行的话 这样 print(‘ your str ’,end=‘’)就可以了
|