python中print不换行

python中print()语法默认会自动换行,实际上print()默认应该为print(x,end='\n')

所以想要不换行只要改变end的值就行了比如 print(x,end = ',')

print('hello')
print('python')
hello
python

print('hello', end=',')
print('python')
hello,python

猜你喜欢

转载自www.cnblogs.com/vevy/p/9122351.html