1. 程式人生 > >Python3的print怎麽讓它不換行

Python3的print怎麽讓它不換行

font ack -s pytho bsp size print spa -a

如何讓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怎麽讓它不換行