Printing Python3打印格式

Printing Python3打印格式,printing,python-3.6,Printing,Python 3.6,我想格式化打印功能的输出 def main(): print('1 2 3 4 5'*7) # Write code here main() Required Output: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 Obtained Output: 1 2 3 4 51 2 3 4 51 2 3 4 51 2 3

我想格式化打印功能的输出

def main():
    print('1 2 3 4 5'*7)
    # Write code here 

main()

Required Output:
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
Obtained Output:
    1 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 5
如何在Python3中使用print函数来执行此任务?

print('1 2 3 4 5\n'*7)


问候

可以将分隔符设置为换行符

print(*7*('1 2 3 4 5',), sep='\n')
同样,您可以在字符串的末尾添加换行符,并从
print
中删除换行符

print(7*'1 2 3 4 5\n', end='')