首页 > 文章列表 > python每行输出五个数

python每行输出五个数

python输出
186 2022-08-07

函数说明

1、默认情况下,每个print函数在输出内容后都会输出换行。当一个print函数输出多个内容时,内容被空格分隔。

语法

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

2、参数为objects、sep 、end、file、flush

实例

j = 0
for i in range(20,81):
    if i % 3 == 0:
        print(i, end="\t")
        j += 1
    if j == 5:
        print()
        j = 0

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。