python print不换行

Python print 输出不换行

方法一

print "123",
print "456"

  中间有间隔

 

方法二

#文件首行或第二行
1:from __future__ import print_function
print('123123', end='')
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) 这是 print() 的原型。默认是以 \n 结尾,即换行。把 \n 换掉就行。
posted @ 2017-04-13 10:21  萌蛋白  阅读(488)  评论(0)    收藏  举报