Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 是否按行而不是列显示输出?_Python_Python 3.x - Fatal编程技术网

Python 是否按行而不是列显示输出?

Python 是否按行而不是列显示输出?,python,python-3.x,Python,Python 3.x,我希望答案并排出现,而不是相互重叠。我该怎么做 n=0 while 1: n=int(input("Enter N=")) if n > 0: break print("Error. please enter only positive numbers.") i=1 print("\nThe divisors of N are:",) while i <=n: if (n%i) == 0: print(i,

我希望答案并排出现,而不是相互重叠。我该怎么做

n=0

while 1:

    n=int(input("Enter N="))
    if n > 0:
             break
    print("Error. please enter only positive numbers.")
i=1
print("\nThe divisors of N are:",)
while i <=n:
    if (n%i) == 0:
        print(i,)
    i+=1
n=0
而1:
n=int(输入(“输入n=”))
如果n>0:
打破
打印(“错误。请只输入正数。”)
i=1
print(“\N N的除数为:”,)

当我使用
sys.stdout.write
代替
print

时,请更改行

        print(i,)

        print(i, end=" ")