Python3的print怎么让它不换行

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python3的print怎么让它不换行相关的知识,希望对你有一定的参考价值。

如何让print不换行

在Python中总是默认换行

 

for y in range(0,10):
    print(y)

 结果:

0
1
2
3
4
5
6
7
8
9

 

 如果想要不换行,在3.x 中应该写成 print(x, end ="")

 

for y in range(0,10):
    print(y, end="")

结果:

0123456789

 

 

 

以上是关于Python3的print怎么让它不换行的主要内容,如果未能解决你的问题,请参考以下文章