下面的代码打印这样的文字:打印文本在一行
John
Smith
02/07/1234
首先,它缩进两个行,我将如何改变代码以打印为: John Smith 02/07/1234
上一个线?
with open("Forename") as f1, open("Surname") as f2, open("Date of birth") as f3:
for forename, surname, birthdate in zip(f1,f2,f3):
print (forename, surname, birthdate)
如果使用不带参数的(),然后将它修剪所有空格字符,因此调用如forename.strip()就足够了。 – Arminius
另外,在括号内为字符串本身添加一些空格:) – droravr